Single Spring based ehcache manager for multiple ehcache.xml files in a multi module project

I have a multi module project with all the modules defining their cache configurations in their own ehcache.xml. This use case is addressed by the now unmaintained "ehcache-spring-annotations" project through a configuration like this:

    <ehcache:annotation-driven cache-manager="ehCacheManager" create-missing-caches="true"/>

    <bean id="ehCacheManager" class="net.sf.itcb.addons.cachemanager.ItcbEhCacheManagerFactoryBean">
      <property name="configLocations" value="classpath*:ehcache.xml"/>
      <property name="shared" value="true"/>

I tried something similar in Spring's Cache Abstraction.


    <bean id="cacheManager"

    <bean id="ehcache"

However, I ran into this exception:

Caused by: 
  class path resource [classpath*:ehcache.xml] cannot be opened because
  it does not exist

Can someone please explain what is the correct way to configure Spring's Cache Abstraction for EhCache in a multi module project?


  • In the end, we moved away from ehcache.xml and started using Java based configuration for our caches which solved this problem.