@Cacheable失效

1 启动类加上注解

@EnableAspectJAutoProxy(exposeProxy = true)
@EnableCaching //开启缓存
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

}

2yml 要加上redis 缓存

redis:
  database: 1
  host: 127.0.0.1
  port: 6379
cache:
  type: redis

猜你喜欢

转载自blog.csdn.net/liangdingguo/article/details/121493655
今日推荐