springcachingjcache

Two CacheManagers overriding each other


I have a JCacheCacheManager injected into my application by a spring boot starter. This works fine until i define an ehCacheCacheManager-Bean inside the same app, which is used in the @cacheable-annotation of a single repository method. This itself works as well, but the injected JCacheCacheManager can not be found any more.


Solution

  • I did it slightly different: I changed the @Cacheable-Annotations referencing a custom CacheResolver Bean witch uses the EhCache. The EhCache itself is no bean anymore. Conflict solved.