栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

SpringBoot使用Ehcache

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

SpringBoot使用Ehcache

配置 maven
        
            org.springframework.boot
            spring-boot-starter-cache
        
        
        
            net.sf.ehcache
            ehcache
        
启动类
@SpringBootApplication
@importResource(locations = "classpath:cache/cache_manager.xml")
EhCacheCacheManager配置



    
    

    
    
        
    

    
    
        
    

ehcache配置



    
    
    

    


记录一下配置中的坑,分享给大家

问题记录 问题1

编译报错

301 Moved Permanently'
问题2

编译报错

Caused by: org.xml.sax.SAXParseException: cvc-elt.1: 找不到元素 'ehcache' 的声明。
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:204) ~[na:1.8.0_251]

问题1把http变成https就会报问题2的错误
问题1和问题2,都是因为使用importResource去加载ehcache.xml
很多人(包括我)喜欢加载文件这样做:

@importResource(locations = "classpath:cache/*.xml")

但ehcache.xml不属于spring的xml配置

github地址

https://github.com/shuaidongshuai/spring-use-ehcache-redis

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/659024.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号