내 응용 프로그램은 Spring 2.5.6, Richfaces 3.1.6.SR1, JSF 1.1_02가있는 Jboss 4.2.2 GA에서 실행됩니다. 내가 원하는 것은 spert를 포함 할 귀 상자 밖에 porpertie 파일을 갖는 것입니다. 같은Spring을 사용한 PropertiesConfiguration에 대한 파일 참조
- 정보 1 = "조이"
- INFORMATION2는 = "디디"
- 정보 3 = "마키"
- [...]이 파일에
의 변화가 있어야한다 즉각적인 영향 . I는 다음과 같이 시작 :
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();
}
}
이 myProperties.properties 내 귀 내부 대상 디렉토리 어딘가에 경우 작업에만 보인다. 그래서 코드를 변경했습니다 :
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);
이 작동합니다. 하지만 절대 경로를 사용하지 않으려합니다. 이미 정의했습니다.
<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>