My application is running on Jboss 4.2.2 GA with Spring 2.5.6, Richfaces 3.1.6.SR1, JSF 1.1_02. What I want is to have a porpertie file outside my ear which will contain s.th. like
- information1="Joey"
- information2="DeeDee"
- information3="Marky"
- [...]
Changes on this file should have immediate impact. I started like this:
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;
[...]
PropertiesConfiguration configure = null;
{
try {
configure = new PropertiesConfiguration("myProperties.properties");
configure.setReloadingStrategy(new FileChangedReloadingStrategy());
configure.setAutoSave(true);
} catch (ConfigurationException e) {
e.printStackTrace();
}
}
This seems only to work if myProperties.properties is somewhere in target directory inside my ear. So I changed my code:
File file = new File(myAppRoot + FSEP + "appserver" + FSEP + "server" + FSEP + "default"
+ FSEP + "conf" + FSEP + "myApp" + FSEP + "myProperties.properties");
configure = new PropertiesConfiguration(file);
configure.setReloadingStrategy(new FileChangedReloadingStrategy());
configure.setAutoSave(true);
This works fine. But I want to avoid using an absolute path.I´ve allready defined a
<bean id="myPropertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
[...]
<property name="locations">
<list>
<value>classpath:myProperties.properties</value>
<value>classpath:myApp/myProperties.properties</value>
</list>
</property>