I believe @dey is correct.
I suspect the problem you are having is that you have not explicitly enabled caching using Spring Framework's @EnableCaching
annotation (Javadoc).
Even with Spring Boot's auto-configuration, and specifically when using Ehcache as a caching provider in Spring Framework's Cache Abstraction, you still need to explicitly enable caching, as described in the documentation.
Ehcache is a supported caching provider (as well as in the core Spring Framework) and Spring Boot does offer auto-configuration logic for this provider (via the JCache API). However, when using Spring Boot, an explicit CacheManager
bean declaration (for Ehcache) in your application configuration is not required, only the @EnableCaching
annotation is required (so long as both Ehcache and spring-boot-starter-cache
are on your application classpath, as you have indicated):
@Configuration
@EnableCaching
class MySpringBootApplicationConfiguration {
// your application managed bean declarations here
}
An explicit CacheManager
bean is required only when 1) you are not using Spring Boot, or 2) Spring does not (provide) support the provider as a caching provider in Spring's Cache Abstraction, in which case you would need to implement Spring's Cache and
CacheManager` SPI yourself, for the unsupported (OOTB) provider.