Commit 6cf2a8edeb0bb8219572d87488f25f993e6415d9
1 parent
67198aed
升级SpringBoot到最新版本2.2.12 提升启动速度
Showing
4 changed files
with
7 additions
and
6 deletions
pom.xml
| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | <dependency> |
| 42 | 42 | <groupId>org.springframework.boot</groupId> |
| 43 | 43 | <artifactId>spring-boot-dependencies</artifactId> |
| 44 | - <version>2.1.18.RELEASE</version> | |
| 44 | + <version>2.2.12.RELEASE</version> | |
| 45 | 45 | <type>pom</type> |
| 46 | 46 | <scope>import</scope> |
| 47 | 47 | </dependency> | ... | ... |
ruoyi-common/src/main/java/com/ruoyi/common/filter/RepeatableFilter.java
| ... | ... | @@ -29,8 +29,8 @@ public class RepeatableFilter implements Filter |
| 29 | 29 | throws IOException, ServletException |
| 30 | 30 | { |
| 31 | 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 | 35 | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); |
| 36 | 36 | } | ... | ... |
ruoyi-common/src/main/java/com/ruoyi/common/filter/XssHttpServletRequestWrapper.java
| ... | ... | @@ -99,7 +99,6 @@ public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper |
| 99 | 99 | public boolean isJsonRequest() |
| 100 | 100 | { |
| 101 | 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 | } |
| 106 | 105 | \ No newline at end of file | ... | ... |
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java
| ... | ... | @@ -8,8 +8,10 @@ import org.springframework.data.redis.connection.RedisConnectionFactory; |
| 8 | 8 | import org.springframework.data.redis.core.RedisTemplate; |
| 9 | 9 | import org.springframework.data.redis.serializer.StringRedisSerializer; |
| 10 | 10 | import com.fasterxml.jackson.annotation.JsonAutoDetect; |
| 11 | +import com.fasterxml.jackson.annotation.JsonTypeInfo; | |
| 11 | 12 | import com.fasterxml.jackson.annotation.PropertyAccessor; |
| 12 | 13 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 14 | +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; | |
| 13 | 15 | |
| 14 | 16 | /** |
| 15 | 17 | * redis配置 |
| ... | ... | @@ -31,7 +33,7 @@ public class RedisConfig extends CachingConfigurerSupport |
| 31 | 33 | |
| 32 | 34 | ObjectMapper mapper = new ObjectMapper(); |
| 33 | 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 | 37 | serializer.setObjectMapper(mapper); |
| 36 | 38 | |
| 37 | 39 | template.setValueSerializer(serializer); | ... | ... |