Is it possible to define a map into a .properties file?
Currently, I have a map in my applicationContext.xml, but since more keys and values are likely to be added (or removed) in the future I would like to move them into a project.properties file.
This is what I have:
Code:
<bean name="myBean" class="myPackage.myClass">
<property name="myMap">
<map>
<entry>
<key>
<value>key1</value>
</key>
<value>value1</value>
</entry>
<entry>
<key>
<value>key2</value>
</key>
<value>value2</value>
</entry>
<!-- more key / value pairs -->
</map>
</property>
</bean>
This is what I would like to have:
Code:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>project.properties</value>
</property>
</bean>
<bean name="myBean" class="myPackage.myClass">
<property name="myMap">
<value>${myMapInProjectProperties}</value>
</property>
</bean>
- Is this possible?
- How do define the key / value pairs in project.properties?
- Is the syntax correct in the last bean that I stated?
BR, Mattias