英文:
IS there a way to configure ehcache 2 for spring boot 3?
问题
I am migrating some legacy app from sb 2 ( spring boot) to sb 3. App is using ehcache with xml configuration to it. In my cacheConfig class I'm using something like this:
import org.springframework.cache.ehcache.EhCacheCacheManager;
@Configuration
@EnableCaching
class Config {
@Bean
CacheManager cacheManager() {
return new EhCacheCacheManager(ehCacheManager())
}
@Bean(destroyMethod = 'shutdown')
net.sf.ehcache.CacheManager ehCacheManager() {
URL url = ("/configFile.xml");
return net.sf.ehcache.CacheManager.newInstance(url);
}
}
However, import org.springframework.cache.ehcache.EhCacheCacheManager;
is no longer present in spring context support 6+ (spring boot 3).
Is there any way to work around it? How can I configure my ehcache with new spring boot 3?
英文:
I am migrating some legacy app from sb 2 ( spring boot) to sb 3. App is using ehcache with xml configuration to it. In my cacheConfig class I'm using something like this:
import org.springframework.cache.ehcache.EhCacheCacheManager;
@Configuration
@EnableCaching
class Config {
@Bean
CacheManager cacheManager() {
return new EhCacheCacheManager(ehCacheManager())
}
@Bean(destroyMethod = 'shutdown')
net.sf.ehcache.CacheManager ehCacheManager() {
URL url = ("/configFile.xml");
return net.sf.ehcache.CacheManager.newInstance(url);
}
however import org.springframework.cache.ehcache.EhCacheCacheManager; is no longer present in spring context support 6+ (spring boot 3).
Is there any way to work around it ? How can I configure my ehcache with new spring boot 3?
答案1
得分: 1
ehcache 2 在 Spring Boot 3 中不再受支持作为缓存提供程序。您需要使用 ehcache 3 与 JSR-107 注解:https://docs.spring.io/spring-boot/docs/3.0.8/reference/html/io.html#io
英文:
ehcache 2 is no longer supported as cache provider in Spring Boot 3. You would have to use ehcache 3 with JSR-107 annotations: https://docs.spring.io/spring-boot/docs/3.0.8/reference/html/io.html#io
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论