From f6f928d81ad53f424f35a9149db11b301ed7f8a8 Mon Sep 17 00:00:00 2001
From: LuoTong <2232327099qq.com>
Date: 星期一, 22 四月 2024 16:25:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/haucheng_panzhihua' into haucheng_panzhihua

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/CacheConfig.java |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/CacheConfig.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/CacheConfig.java
index 0b8f8b3..e449b75 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/CacheConfig.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/redis/CacheConfig.java
@@ -2,6 +2,7 @@
 
 import java.time.Duration;
 
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import org.springframework.cache.CacheManager;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -38,7 +39,12 @@
 
         ObjectMapper objectMapper = new ObjectMapper();
         objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
-        objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+//        objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+
+        objectMapper.activateDefaultTyping(
+                objectMapper.getPolymorphicTypeValidator(),
+                ObjectMapper.DefaultTyping.NON_FINAL,
+                JsonTypeInfo.As.PROPERTY);
 
         jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
 

--
Gitblit v1.7.1