SpringCloudAlibaba- You can switch to using Caffeine cache, by adding it xxxxx

背景

SpringCloudAlibaba 负载均衡从ribbon替换成spring-cloud-loadbalancer 过程中出现警告:

报错信息

2021-08-18 18:42:55.841  INFO 31065 --- [           main] c.a.c.s.g.s.SentinelSCGAutoConfiguration : [Sentinel SpringCloudGateway] register SentinelGatewayBlockExceptionHandler
2021-08-18 18:42:56.026  INFO 31065 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.util.MsUtil CLASS_CACHE cache.
2021-08-18 18:42:56.027  INFO 31065 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.genid.GenIdUtil CACHE cache.
2021-08-18 18:42:56.027  INFO 31065 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear tk.mybatis.mapper.version.VersionUtil CACHE cache.
2021-08-18 18:42:56.028  INFO 31065 --- [           main] t.m.m.autoconfigure.MapperCacheDisabler  : Clear EntityHelper entityTableMap cache.
2021-08-18 18:42:56.438  WARN 31065 --- [           main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2021-08-18 18:42:56.904  INFO 31065 --- [           main] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 9070
2021-08-18 18:42:56.945  INFO 31065 --- [           main] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, DEFAULT_GROUP gsch-gateway-server 192.168.100.26:9070 register finished
2021-08-18 18:42:56.976  INFO 31065 --- [           main] c.z.gsch.gateway.GschGatewayApplication  : Started GschGatewayApplication in 5.499 seconds (JVM running for 6.222)

在这里插入图片描述

解决方案

Add the below library in your pom.xml

<!-- https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine -->
<dependency>
    <groupId>com.github.ben-manes.caffeine</groupId>
    <artifactId>caffeine</artifactId>
    <version>2.8.8</version>
</dependency>

or in your build.gradle

// https://mvnrepository.com/artifact/com.github.ben-manes.caffeine/caffeine
compile group: 'com.github.ben-manes.caffeine', name: 'caffeine', version: '2.8.8'

You can replace the suitable/latest version of caffeine.

什么是 Caffeine Cache?

请参考以下几篇文章

Caffeine Cache实战
https://www.jianshu.com/p/3434991ad075

深入解密来自未来的缓存-Caffeine
https://juejin.cn/post/6844903670014803981

[译] 高性能 Java 缓存库 — Caffeine
https://juejin.cn/post/6844903506223038477

参考

升级 Spring Boot、Cloud 版本记录
http://dudu88.cn/2020/06/20/upgrade-spring-version-record/

How to solve "Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache’ warning?

https://stackoverflow.com/questions/65227645/how-to-solve-spring-cloud-loadbalancer-is-currently-working-with-the-default-ca

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值