Using String Property in Spring XML Configuration File

Is there a way to set the bean property in the Spring configuration file as a string file read from the properties file?

eg.

<bean id="...." class="...."> <property name="loginURL">GET_THIS_VALUE_FROM_'ENV.PROPERTIES'_FILE</property> </bean> 
+4
source share
1 answer

You can use PropertyPlaceHolderConfigurer to load the properties file, and then access the properties using the Spring -EL expression -

 <context:property-placeholder location="classpath:custom.properties"/> <bean id="...." class="...."> <property name="loginURL">${propname}</property> </bean> 
+10
source

All Articles