mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 20:57:23 +08:00
refactor: 封装公共配置,降低使用复杂度
This commit is contained in:
@@ -28,6 +28,8 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import top.charles7c.continew.starter.core.handler.GeneralPropertySourceFactory;
|
||||
import top.charles7c.continew.starter.json.jackson.serializer.BigNumberSerializer;
|
||||
|
||||
import java.math.BigInteger;
|
||||
@@ -45,6 +47,7 @@ import java.util.TimeZone;
|
||||
*/
|
||||
@Slf4j
|
||||
@AutoConfiguration
|
||||
@PropertySource(value = "classpath:default-json-jackson.yml", factory = GeneralPropertySourceFactory.class)
|
||||
public class JacksonAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
|
@@ -0,0 +1,21 @@
|
||||
--- ### Spring 配置
|
||||
spring:
|
||||
## MVC 配置
|
||||
mvc:
|
||||
format:
|
||||
# 日期格式化(针对 java.util.Date)
|
||||
date-time: yyyy-MM-dd HH:mm:ss
|
||||
## Jackson 配置
|
||||
jackson:
|
||||
# 时区配置
|
||||
time-zone: GMT+8
|
||||
# 日期格式化(针对 java.util.Date)
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
# 序列化配置(Bean -> JSON)
|
||||
serialization:
|
||||
# 允许序列化无属性的 Bean
|
||||
FAIL_ON_EMPTY_BEANS: false
|
||||
# 反序列化配置(JSON -> Bean)
|
||||
deserialization:
|
||||
# 允许反序列化不存在的属性
|
||||
FAIL_ON_UNKNOWN_PROPERTIES: false
|
Reference in New Issue
Block a user