【发布时间】:2017-08-10 22:46:05
【问题描述】:
我正在尝试读取 pom.xml 的值并将其注入 application.properties。但我无法做到这一点。 在我的 pom.xml 中,我的属性值如下:
<properties>
<app.mobile.db.host>
${env.APP_MOBILE_DB_HOST}
</app.mobile.db.host>
...
</properties>
而且,APP_MOBILE_DB_HOST 来自 .m2 文件夹的 settings.xml。 我也在 pom.xml 中添加了以下几行。
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
....
在 application.properties 我访问喜欢
app.host= @app.mobile.db.host@
在 Spring Boot 中,我使用 @ConfigurationProperties 从 application.properties 读取值。 但是当我打印它时,它只会打印@app.mobile.db.host@。 我哪里错了?请帮忙。
【问题讨论】: