Is it possible to stack loaded properties in Java? For instance can I do:
Properties properties = new Properties();
properties.load(new FileInputStream(\"file1.
You can do this a little more dynamical, working with an indeterminate number of files.
The parameter for this method should be a list with the path to the property file. I made the method static, put it on a class with other message handling related functions, and simply call it when I need it:
public static Properties loadPropertiesFiles(LinkedList files) {
try {
Properties properties = new Properties();
for(String f:files) {
Resource resource = new ClassPathResource( f );
Properties tempProp = PropertiesLoaderUtils.loadProperties(resource);
properties.putAll(tempProp);
}
return properties;
}
catch(IOException ioe) {
return new Properties();
}
}