From db2dfcf32f25e607a0c2f351031d3fff8bf93dcc Mon Sep 17 00:00:00 2001 From: click33 <2393584716@qq.com> Date: Tue, 16 May 2023 16:35:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20sa-token-redis-jackson=20?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E4=BB=A3=E7=A0=81=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cn/dev33/satoken/dao/SaTokenDaoRedisJackson.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sa-token-plugin/sa-token-redis-jackson/src/main/java/cn/dev33/satoken/dao/SaTokenDaoRedisJackson.java b/sa-token-plugin/sa-token-redis-jackson/src/main/java/cn/dev33/satoken/dao/SaTokenDaoRedisJackson.java index 1df14161..418a5809 100644 --- a/sa-token-plugin/sa-token-redis-jackson/src/main/java/cn/dev33/satoken/dao/SaTokenDaoRedisJackson.java +++ b/sa-token-plugin/sa-token-redis-jackson/src/main/java/cn/dev33/satoken/dao/SaTokenDaoRedisJackson.java @@ -104,8 +104,7 @@ public class SaTokenDaoRedisJackson implements SaTokenDao { try { Field field = GenericJackson2JsonRedisSerializer.class.getDeclaredField("mapper"); field.setAccessible(true); - ObjectMapper objectMapper = (ObjectMapper) field.get(valueSerializer); - this.objectMapper = objectMapper; + this.objectMapper = (ObjectMapper) field.get(valueSerializer); // 配置[忽略未知字段] this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -138,7 +137,7 @@ public class SaTokenDaoRedisJackson implements SaTokenDao { stringTemplate.afterPropertiesSet(); // 构建RedisTemplate - RedisTemplate template = new RedisTemplate(); + RedisTemplate template = new RedisTemplate<>(); template.setConnectionFactory(connectionFactory); template.setKeySerializer(keySerializer); template.setHashKeySerializer(keySerializer); @@ -308,7 +307,7 @@ public class SaTokenDaoRedisJackson implements SaTokenDao { @Override public List searchData(String prefix, String keyword, int start, int size, boolean sortType) { Set keys = stringRedisTemplate.keys(prefix + "*" + keyword + "*"); - List list = new ArrayList(keys); + List list = new ArrayList<>(keys); return SaFoxUtil.searchList(list, start, size, sortType); }