springboot整合ehcache
工具类实现缓存
1. jar包导入
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-starter-cacheartifactId>
dependency>
<dependency>
<groupId>net.sf.ehcachegroupId>
<artifactId>ehcacheartifactId>
dependency>
2. ehcache.xml配置文件编写
undefined
3. 工具类编写
package com.example.ehcachedemo.util;import net.sf.ehcache.Cache;import net.sf.ehcache.CacheManager;import net.sf.ehcache.Element;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.util.ClassUtils;
注解实现
1. 导入依赖 ,编写xml文件,
与工具类实现相同
2. yaml文件配置
spring
3.注解实现
undefined
4. 测试
undefined
Original: https://www.cnblogs.com/oeds/p/15762956.html
Author: 念星河
Title: springboot整合ehcache
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/592473/
转载文章受原作者版权保护。转载请注明原作者出处!