chore(config): 移除自定义Jackson配置并添加JSR310支持
- 删除了自定义的Jackson序列化配置类 - 添加了jackson-datatype-jsr310依赖以支持日期时间序列化 - 简化了项目配置结构
This commit is contained in:
@ -36,6 +36,10 @@
|
|||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
package vip.jcfd.web.config;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
||||||
|
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class JacksonConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder() {
|
|
||||||
ToStringSerializer toStringSerializer = ToStringSerializer.instance;
|
|
||||||
return new Jackson2ObjectMapperBuilder()
|
|
||||||
.modules(new SimpleModule()
|
|
||||||
.addSerializer(Long.class, toStringSerializer)
|
|
||||||
.addSerializer(Long.TYPE, toStringSerializer)
|
|
||||||
.addSerializer(BigInteger.class, toStringSerializer)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user