【发布时间】:2019-07-03 08:17:45
【问题描述】:
我正在开发一个 Spring MVC 项目(版本 > 4.x)。这不是一个 Spring Boot 项目。 我需要一种机制来维护特定于环境的文件夹,例如“DEV”、“PROD”、“UAT”等。这些文件夹中的每一个都将具有特定于该特定环境的属性。 我已将我的 PropertiesPlaceholder 配置如下:
<context:property-placeholder
location="classpath:application-default.properties, classpath:application-${env}.properties"
ignore-unresolvable="true" />
我的属性定义如下:
-src
-main
-Resources
-Properties
-application-dev.properties
-application-prod.properties
我希望占位符 ${env} 在运行时得到解析,以便 propertyplaceholder 只读取与该环境相关的属性。
我很想听听你们的 cmets 以及围绕它的最佳实践。在更高的环境中,我们将有一个 Jenkins 管道为我们进行构建。
【问题讨论】:
标签: spring spring-mvc properties production-environment