解决 springboot 中 @Cacheable不起作用
- application.properties中记得启用缓存
spring.cache.type=redis

- 缓存的对象必须实现Serializable

- SpringBootApplication中要加
@EnableCaching注解

@Cacheable是基于Spring AOP代理类,内部方法调用是不走代理的,@Cacheable是不起作用的

spring.cache.type=redis

@EnableCaching注解
@Cacheable是基于Spring AOP代理类,内部方法调用是不走代理的,@Cacheable是不起作用的