Hi,
I load a property file from classpath with the method :
String cheminFichier = new StringBuilder(100).append(classeBP.getPackage().getName().replace(".", "/")).append(File.separator).append(
REPERTOIRE_MAPPING).append(nomFichier).append(".properties").toString();
InputStream isMapping = Thread.currentThread().getContextClassLoader().getResourceAsStream(cheminFichier.toString());
if (isMapping == null)
{
throw new ServiceMappingException("Erreur lors du chargement du mapping du service. Le fichier "
+ cheminFichier + " n'existe pas.");
}
else
{
Properties mapping = new Properties();
try
{
mapping.load(isMapping);
}
catch (IOException e)
...
}
Ok, it's work. But if I modify the content of the property file when Tomcat is running, changes are ignored. It's not hot-reloaded as with classes.
My context is configured with reloadable="true"
option and the classloader returned by Thread.currentThread().getContextClassLoader() is the WEBAPP classloader (not the system classloader or other).
I read it's possible to use ServletContext.getResourceAsStream, but I haven't access to the servlet context.
It's Tomcat 5.5.
Any idea ? If not, do you have a solution for forcing to reload a specific resource (my property file) ?
Thanks !