Much like providing a list of properties files in priority for PropertyPlaceholderConfigurer, it would be nice to be able to do the same for EhCacheManagerFactoryBean. This would allow a default EhCache configuration to be inside your Jar/War on the classpath, and if need be, you can override that configuration by providing another location to load from.
Example XML:
<bean id="cacheManager"
class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
<property name="configLocations">
<list>
<value>classpath*:ehcache.override.xml</value>
<value>classpath*:META-INF/ehcache.default.xml</value>
</list>
</property>
</bean>
Example code that should be added to EhCacheManagerFactoryBean (or in a subclass of it):
/**
- Based on an array of configuration location {@link Resource}s listed in
* order of decending priority, this will use the first available
* {@link Resource} to configure the EhCache CacheManager.
- @return the config location {@link Resource} to use
*/
public void setConfigLocations(final Resource[] configLocations) {
if (configLocations == null || configLocations.length < 0) {
logger.info("No valid configLocations were set.");
return;
}
// uses the first available config location
super.setConfigLocation(configLocations[0]);
}