- application.properties中记得启用缓存
spring.cache.type=redis
- 缓存的对象必须实现Serializable
- SpringBootApplication中要加
@EnableCaching
注解
-
@Cacheable
是基于Spring AOP代理类,内部方法调用是不走代理的,@Cacheable
是不起作用的
spring.cache.type=redis
@EnableCaching
注解@Cacheable
是基于Spring AOP代理类,内部方法调用是不走代理的,@Cacheable
是不起作用的将博客搬至CSDN
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M