我尝试将Ehcache 3集成到Sping Boot 2.7.7应用程序中,但在启动过程中,应用程序失败,并显示以下错误消息: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')
根据文档,将Ehcache添加到类路径/依赖项中并提供一个ehcache.xml
文件就足够了。
我的(相关)依赖项如下所示:
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
我的application.properties
包含以下与chache相关的条目:
spring.cache.type=ehcache
你知道可能少了什么吗?
1条答案
按热度按时间j13ufse21#
错误是
spring.cache.type
的值不正确。将该属性的值更改为jcache
可解决此问题。也可以忽略此属性。