From 6cf2a8edeb0bb8219572d87488f25f993e6415d9 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 16 Dec 2020 10:05:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7SpringBoot=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC2.2.12=20=E6=8F=90=E5=8D=87=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../main/java/com/ruoyi/common/filter/RepeatableFilter.java | 4 ++-- .../com/ruoyi/common/filter/XssHttpServletRequestWrapper.java | 3 +-- .../src/main/java/com/ruoyi/framework/config/RedisConfig.java | 4 +++- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index e5954a9a5..d15458b17 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ org.springframework.boot spring-boot-dependencies - 2.1.18.RELEASE + 2.2.12.RELEASE pom import diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java index 15a6804f2..3698c75c3 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java @@ -29,8 +29,8 @@ public class RepeatableFilter implements Filter throws IOException, ServletException { ServletRequest requestWrapper = null; - if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(), - MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) + if (request instanceof HttpServletRequest + && StringUtils.equalsAnyIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) { requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java index 12ef5517c..6794394c9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java @@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper public boolean isJsonRequest() { String header = super.getHeader(HttpHeaders.CONTENT_TYPE); - return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header) - || MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header); + return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header); } } \ No newline at end of file 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 6322686fb..5eeabda2a 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 @@ -8,8 +8,10 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.serializer.StringRedisSerializer; import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; /** * redis配置 @@ -31,7 +33,7 @@ public class RedisConfig extends CachingConfigurerSupport ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY); serializer.setObjectMapper(mapper); template.setValueSerializer(serializer);