springboot提供缓存注解标签
@Cacheable ,当使用ehcache时,autoconfig机制会根据配置文件自动去初始化bean
而shiroConfig在@Configuration构造时,也会去初始化ehcache ,项目启动会产生如下异常
org.apache.shiro.cache.CacheException: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
按照网上的说,使用低版本的ehcache可解决该问题,没找到完美解决的方法
查看了下源代码
EhCacheCacheConfiguration在
@Bean
@ConditionalOnMissingBean
public net.sf.ehcache.CacheManager ehCacheCacheManager() {
Resource location = this.cacheProperties.resolveConfigLocation(this.cach