小编Bin*_* Le的帖子

使用Redis的Spring缓存 - 如果连接失败到Redis,如何优雅地处理甚至跳过缓存

我在Spring应用程序中启用了缓存,并使用Redis来实现此目的.但是,每当发生连接失败时,应用程序就会停止工作,而我认为最好跳过缓存并继续执行正常的执行流程.

那么,有没有人知道如何在Spring中优雅地做到这一点?

这是我得到的例外.

Caused by: org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
Run Code Online (Sandbox Code Playgroud)

spring-data-redis spring-cache

11
推荐指数
1
解决办法
4469
查看次数

标签 统计

spring-cache ×1

spring-data-redis ×1