Commit 0348349a86b64eb4dd959c29c339f75b2fdb26d9

Authored by RuoYi
1 parent 436f8eb7

Jackson日期反序列化时区问题

ruoyi/src/main/java/com/ruoyi/framework/config/ApplicationConfig.java
1 1 package com.ruoyi.framework.config;
2 2  
  3 +import java.util.TimeZone;
3 4 import org.mybatis.spring.annotation.MapperScan;
  5 +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
  6 +import org.springframework.context.annotation.Bean;
4 7 import org.springframework.context.annotation.Configuration;
5 8 import org.springframework.context.annotation.EnableAspectJAutoProxy;
6 9  
... ... @@ -16,5 +19,12 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
16 19 @MapperScan("com.ruoyi.project.**.mapper")
17 20 public class ApplicationConfig
18 21 {
19   -
  22 + /**
  23 + * 时区配置
  24 + */
  25 + @Bean
  26 + public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization()
  27 + {
  28 + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
  29 + }
20 30 }
... ...