I try to integrate Ehcache 3 into a Spring Boot 2.7.7 application, but during startup, the application fails with the following error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cacheAutoConfigurationValidator' defined in class path resource [org/springframework/boot/autoconfigure/cache/CacheAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No cache manager could be auto-configured, check your configuration (caching type is 'EHCACHE') ... Caused by: java.lang.IllegalArgumentException: No cache manager could be auto-configured, check your configuration (caching type is 'EHCACHE')
According the documentation it should be enough to add Ehcache to the classpath/dependencies, and to provide a ehcache.xml file.
My (relevant) dependencies looks like this:
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
My application.properties contains the following chache related entry:
spring.cache.type=ehcache
Any idea what might be missing?
The error was the wrong value for
spring.cache.type. Changing the value of the property tojcachesolved the issue.It is also possible to leave this property out.