package eu.dnetlib.repo.manager.config; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import java.util.Properties; /** * CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties * override the previous. It also supports property expansion like: * * * something = 1 * somethingelse = 2 * test = ${something}/${somethingelse} * * *

* And if you override something to XX, then test will become XX/2 *

* * * @author marko * */ public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean { private Properties properties; public void afterPropertiesSet() throws Exception { this.properties = mergeProperties(); // Convert the merged properties, if necessary. convertProperties(this.properties); logger.debug("Properties: " + properties); } public Properties getProperties() { return properties; } @Override public void setProperties(final Properties properties) { this.properties = properties; } }