V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
asanelder
V2EX  ›  程序员

请教一个关于 mybatis-generator-plugin 读取 application.properties 文件内容的事

  •  
  •   asanelder · 2021-09-16 20:59:40 +08:00 · 716 次点击
    这是一个创建于 924 天前的主题,其中的信息可能已经有所发展或是发生改变。
    是这样子的, 俺想利用 mybatis-generator-plugin 来自动生成 dao 相关的文件.
    所以需要连接数据库, 从数据库中读取信息.
    但不从的环境数据库的 url, username, password 不一样.
    这三者信息是配置在 application.properties 文件中.
    俺想利用 maven 的 profile, 多个环境定义多个 profile, profile 中再定义 properties, 在处理 resource 时, 根据不同的 profile 来替换 application.properties 中的 url, username, password.

    然后 mybatis-generator 的配置文件从替换后的 application.properties 中读这个值.

    但替换后的 application.properties 是在 target/classes 文件夹下, mybatis-generator 的配置文件好像读不到这个文件.

    俺参考的是
    https://mybatis.org/generator/configreference/properties.html

    有没有铁子处理过类似的情况?
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2926 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:12 · PVG 19:12 · LAX 04:12 · JFK 07:12
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.