Thursday, 16 August 2012

Spring config

Properties

Using properties files is a handy way of externalizing the config without forcing people to play about with spring xml. The easiest way of dealing with this is though PropertyPlaceholderConfigurer. You can pass to it a property set of locations which then is a list of locations. See the snippet below.

1
2
3
4
5
6
7
8
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
 <property name="locations">
  <list>
   <value>classpath:warehouse.adaptor.properties</value>
   <value>classpath:warehouse.adaptor.scheduler.properties</value>
  </list>
 </property>
</bean>

These properties can then be referenced through ${}.

No comments:

Post a Comment