我在将 Spring 4.2.1 中的属性文件中的密钥作为环境变量注入时遇到问题。
我有如下 myapp.properties
myapp.test.data=1
dataSource.jdbcUrl=jdbc://h2:12456
auth.security.role=admin
请让我知道如何使用环境变量注入上述变量。
我尝试了 UPPERCASE_UNDERSCORE 格式不知何故不起作用。
春季:4.2.5-发布
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:module.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="ignoreResourceNotFound" value="true" />
<property name="searchSystemEnvironment" value="true" />
<property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
</bean>