Reputation: 513
I have environment property in application, like portal.db.pwd. Now I want to read it into xml, like:
<bean id="testBean" class="com.example.service.TestBean" depends-on="customerService" lazy-init="true">
<!-- <property name="message" value="# {systemProperties['portal.db.password']}" /> -->
<property name="message" value="${portal.db.password}" />
</bean>
try two ways, both of them could not work.
Upvotes: 1
Views: 569
Reputation: 22972
You have to add properties place holder configuration to use those properties into your XML file,
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>yourFile.properties</value>
</property>
</bean>
Upvotes: 1