<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="locations"> <list> <value>classpath:config/application.properties</value> <value>classpath:config/database/database.properties</value> </list> </property> </bean> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="properties" ref="applicationProperties" /> </bean>I guess that was the classic design of a Spring project. Let's assume the application.properties file containing following content:
input.path=./
output.path=./
In order to read that properties, this is what I did in a my class:
public class MyClass protected Logger log = Logger.getLogger(this.getClass().getName()); @Value("#{applicationProperties['input.path']}") private String filePath; ... ... }
No comments:
Post a Comment