作者 RuoYi

升级SpringBoot到最新版本2.2.12 提升启动速度

@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 <dependency> 41 <dependency>
42 <groupId>org.springframework.boot</groupId> 42 <groupId>org.springframework.boot</groupId>
43 <artifactId>spring-boot-dependencies</artifactId> 43 <artifactId>spring-boot-dependencies</artifactId>
44 - <version>2.1.18.RELEASE</version> 44 + <version>2.2.12.RELEASE</version>
45 <type>pom</type> 45 <type>pom</type>
46 <scope>import</scope> 46 <scope>import</scope>
47 </dependency> 47 </dependency>
@@ -29,8 +29,8 @@ public class RepeatableFilter implements Filter @@ -29,8 +29,8 @@ public class RepeatableFilter implements Filter
29 throws IOException, ServletException 29 throws IOException, ServletException
30 { 30 {
31 ServletRequest requestWrapper = null; 31 ServletRequest requestWrapper = null;
32 - if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(),  
33 - MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) 32 + if (request instanceof HttpServletRequest
  33 + && StringUtils.equalsAnyIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE))
34 { 34 {
35 requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); 35 requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
36 } 36 }
@@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper @@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper
99 public boolean isJsonRequest() 99 public boolean isJsonRequest()
100 { 100 {
101 String header = super.getHeader(HttpHeaders.CONTENT_TYPE); 101 String header = super.getHeader(HttpHeaders.CONTENT_TYPE);
102 - return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header)  
103 - || MediaType.APPLICATION_JSON_UTF8_VALUE.equalsIgnoreCase(header); 102 + return MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(header);
104 } 103 }
105 } 104 }
@@ -8,8 +8,10 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; @@ -8,8 +8,10 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
8 import org.springframework.data.redis.core.RedisTemplate; 8 import org.springframework.data.redis.core.RedisTemplate;
9 import org.springframework.data.redis.serializer.StringRedisSerializer; 9 import org.springframework.data.redis.serializer.StringRedisSerializer;
10 import com.fasterxml.jackson.annotation.JsonAutoDetect; 10 import com.fasterxml.jackson.annotation.JsonAutoDetect;
  11 +import com.fasterxml.jackson.annotation.JsonTypeInfo;
11 import com.fasterxml.jackson.annotation.PropertyAccessor; 12 import com.fasterxml.jackson.annotation.PropertyAccessor;
12 import com.fasterxml.jackson.databind.ObjectMapper; 13 import com.fasterxml.jackson.databind.ObjectMapper;
  14 +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
13 15
14 /** 16 /**
15 * redis配置 17 * redis配置
@@ -31,7 +33,7 @@ public class RedisConfig extends CachingConfigurerSupport @@ -31,7 +33,7 @@ public class RedisConfig extends CachingConfigurerSupport
31 33
32 ObjectMapper mapper = new ObjectMapper(); 34 ObjectMapper mapper = new ObjectMapper();
33 mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); 35 mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
34 - mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); 36 + mapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
35 serializer.setObjectMapper(mapper); 37 serializer.setObjectMapper(mapper);
36 38
37 template.setValueSerializer(serializer); 39 template.setValueSerializer(serializer);