春季启动版本:2.5.0
我有不同的属性文件。jar 内有 3 个,服务器上有 1 个(用于覆盖特定于服务器的属性)
活动配置文件和外部属性的路径在 application.properties 中配置。
spring.profiles.active=@prodProfile@
spring.config.import=optional:file:./application-local.properties
Run Code Online (Sandbox Code Playgroud)
其中 @prodProfile@ 的值来自 pom.xml 的配置文件配置部分。
<properties>
<prodProfile>prod</prodProfile>
</properties>
Run Code Online (Sandbox Code Playgroud)
如果我在 application-prod.properties 和 application-local.properties 中有相同的属性,哪个优先?当我测试时,我发现配置文件特定具有优先权。无法使用 spring.config.import 覆盖属性值。这是预期的行为吗?
| 归档时间: |
|
| 查看次数: |
4750 次 |
| 最近记录: |