• 请不要在回答技术问题时复制粘贴 AI 生成的内容
asanelder
V2EX  ›  程序员

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

  •  
  •   asanelder · Sep 16, 2021 · 1095 views
    This topic created in 1700 days ago, the information mentioned may be changed or developed.
    是这样子的, 俺想利用 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

    有没有铁子处理过类似的情况?
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5947 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 262ms · UTC 02:05 · PVG 10:05 · LAX 19:05 · JFK 22:05
    ♥ Do have faith in what you're doing.