Spring boot 和 redis 注意点

① 启动类添加 @EnableCaching 注解

@EnableCaching
@SpringBootApplication
public class MyApplication {

② 修改application.yml配置文件

spring:
  cache:
    type: redis

③  java Bean  实现 Serializable 接口

public class User implements Serializable {
……
}

④ 类的内部方法相互调用不走缓存

因为基于AOP实现

原文地址:https://www.cnblogs.com/devan/p/11672901.html