How to reference java environment variable when using spring config
For example:
Using Tomcat server, ${catalina.home} is one of the system variable provided by Tomcat
In abc.properties file,
test.ref1=${catalina.home}
In context.xml (or whatever context xml file you referencing),
<!– Properties –>
<bean class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
<property name=”locations”>
<list>
<value>classpath:properties/abc.properties</value>
</list>
</property>
</bean>
In the your class bean,
@Value(“${test.ref1}”)
private String testRef1;