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

前端 未结 17 1941
囚心锁ツ
囚心锁ツ 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:02

    As of Spring Boot 2.1.2 the following configuration worked to resolve the issue. (Note, these are snippets of the overall config.)

    Dependencies:

    
      org.springframework.boot
      spring-boot-starter-cache
    
    
      org.hibernate
      hibernate-core
      5.2.8.Final
    
    
      org.hibernate
      hibernate-ehcache
      5.2.8.Final
    
    

    application.yml config:

    spring:
      jpa:
        open-in-view: false
        hibernate:
          ddl-auto: none
        show-sql: true
        properties:
          dialect: org.hibernate.dialect.MySQLDialect
          net:
            sf:
              ehcache:
                configurationResourceName: ehcache.xml
          hibernate:
            cache:
              use_second_level_cache: true
              region:
                factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
    

    ehcache.xml configuration:

    
    
      
      
      
    
      
      
    
    

    The application I am working on slows down drastically without a working cache. So, to validate I simply ran the application and hit one of the read intense endpoints.

提交回复
热议问题