I've got a DefaultConfigurationBuilder (from commons-configuration v1.9). This object (named config) is initialized by this very simple file :
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system/>
<properties fileName="webapp-commons.properties" throwExceptionOnMissing="true">
<reloadingStrategy refreshDelay="1000" config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
</properties>
So a modification to webapp-commons.properties file must force the reload of the file. But this is not working as expected. Here is my little test :
log.debug("Go pour modifier le fichier !");
for (int i=0; i < 10 ; i++) {
System.out.println("-- value : "+config.getString("clouderial.business.application.name"));
Thread.sleep(3000);
}
log.debug("Vous auriez du modifier le fichier");
The value "clouderial.business.application.name" never change.
Any help woould be appreciated.
JM.
The solution is simple : just add a header to your configuration file :
<header>
<result forceReloadCheck="true"/>
</header>
and it works.
The complete configuration file is now :
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<header>
<result forceReloadCheck="true"/>
</header>
<system/>
<properties fileName="webapp-commons.properties" throwExceptionOnMissing="true">
<reloadingStrategy refreshDelay="1000" config-class="org.apache.commons.configuration.reloading.FileChangedReloadingStrategy"/>
</properties>
</configuration>