Another unnamed CacheManager already exists in the same VM (ehCache 2.5)

前端 未结 17 1954
囚心锁ツ
囚心锁ツ 2020-11-30 20:41

This is what happens when I run my junit tests...

Another CacheManager with same name \'cacheManager\' already exists in the same VM. Please 
provide unique          


        
17条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 21:20

    Your EhCacheManagerFactoryBean may be a singleton, but it's building multiple CacheManagers and trying to give them the same name. That violates Ehcache 2.5 semantics.

    Versions of Ehcache before version 2.5 allowed any number of CacheManagers with the same name (same configuration resource) to exist in a JVM.

    Ehcache 2.5 and higher does not allow multiple CacheManagers with the same name to exist in the same JVM. CacheManager() constructors creating non-Singleton CacheManagers can violate this rule

    Tell the factory bean to created a shared instance of the CacheManager in the JVM by setting the shared property to true.

    
    

提交回复
热议问题