From 3a918ae8f6009dac395202b874c5c874f2c24b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 13 May 2022 09:37:34 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=B0=83=E6=95=B4=20CacheManager=20?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=B3=BB=E7=BB=9F=20=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8C=96=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/framework/config/RedisConfig.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java index d8cbba25..8364c646 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java @@ -1,7 +1,7 @@ package com.ruoyi.framework.config; import cn.hutool.core.util.ObjectUtil; -import com.ruoyi.common.utils.JsonUtils; +import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.framework.config.properties.RedissonProperties; import lombok.extern.slf4j.Slf4j; @@ -44,9 +44,12 @@ public class RedisConfig extends CachingConfigurerSupport { @Autowired private RedissonProperties redissonProperties; + @Autowired + private ObjectMapper objectMapper; + @Primary @Bean(destroyMethod = "shutdown") - public RedissonClient redisson() { + public RedissonClient redisson(RedisProperties redisProperties, RedissonProperties redissonProperties, ObjectMapper objectMapper) { String prefix = REDIS_PROTOCOL_PREFIX; if (redisProperties.isSsl()) { prefix = REDISS_PROTOCOL_PREFIX; @@ -54,7 +57,7 @@ public class RedisConfig extends CachingConfigurerSupport { Config config = new Config(); config.setThreads(redissonProperties.getThreads()) .setNettyThreads(redissonProperties.getNettyThreads()) - .setCodec(new JsonJacksonCodec(JsonUtils.getObjectMapper())); + .setCodec(new JsonJacksonCodec(objectMapper)); RedissonProperties.SingleServerConfig singleServerConfig = redissonProperties.getSingleServerConfig(); if (ObjectUtil.isNotNull(singleServerConfig)) { @@ -113,7 +116,7 @@ public class RedisConfig extends CachingConfigurerSupport { cacheConfig.setMaxSize(group.getMaxSize()); config.put(group.getGroupId(), cacheConfig); } - return new RedissonSpringCacheManager(redissonClient, config, JsonJacksonCodec.INSTANCE); + return new RedissonSpringCacheManager(redissonClient, config, new JsonJacksonCodec(objectMapper)); } /**