From b43181b02d4bab079a9cef1c817bf475a6363fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Wed, 8 Mar 2023 10:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20sonar=E3=80=91RedisConfig?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jero/common/modules/redis/config/RedisConfig.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/config/RedisConfig.java b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/config/RedisConfig.java index 775284f5..692dcbf0 100644 --- a/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/config/RedisConfig.java +++ b/jero-boot/jero-boot-base/jero-boot-base-tools/src/main/java/com/jero/common/modules/redis/config/RedisConfig.java @@ -74,7 +74,7 @@ public class RedisConfig extends CachingConfigurerSupport { public RedisTemplate redisTemplate(LettuceConnectionFactory lettuceConnectionFactory) { log.info(" --- redis config init --- "); // Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = jacksonSerializer(); - RedisTemplate redisTemplate = new RedisTemplate(); + RedisTemplate redisTemplate = new RedisTemplate<>(); redisTemplate.setConnectionFactory(lettuceConnectionFactory); RedisSerializer stringSerializer = new StringRedisSerializer(); @@ -109,11 +109,9 @@ public class RedisConfig extends CachingConfigurerSupport { //update-begin-author:taoyan date:20210316 for:注解CacheEvict根据key删除redis支持通配符* RedisCacheWriter writer = new JeroRedisCacheWriter(factory, Duration.ofMillis(50L)); // 创建默认缓存配置对象 - RedisCacheManager cacheManager = RedisCacheManager.builder(writer).cacheDefaults(redisCacheConfiguration) + return RedisCacheManager.builder(writer).cacheDefaults(redisCacheConfiguration) .withInitialCacheConfigurations(singletonMap(CacheConstant.SYS_DICT_TABLE_CACHE, RedisCacheConfiguration.defaultCacheConfig().entryTtl(Duration.ofMinutes(10)).disableCachingNullValues().serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(this.jacksonSerializer)))) .transactionAware().build(); - //update-end-author:taoyan date:20210316 for:注解CacheEvict根据key删除redis支持通配符* - return cacheManager; } /**