feature(configuration,forest): 增加 jackson LocalDatetime 等Java时间类型适配
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.lanyuanxiaoyao.service.configuration;
|
||||
|
||||
import com.fasterxml.jackson.datatype.eclipsecollections.EclipseCollectionsModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -17,6 +18,7 @@ public class JacksonConfiguration {
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
return builder -> {
|
||||
builder.modules(new EclipseCollectionsModule());
|
||||
builder.modules(new JavaTimeModule());
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.lanyuanxiaoyao.service.forest.configuration;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.dtflys.forest.converter.json.ForestJacksonConverter;
|
||||
import com.dtflys.forest.springboot.annotation.ForestScan;
|
||||
import com.dtflys.forest.springboot.properties.ForestConfigurationProperties;
|
||||
import com.fasterxml.jackson.datatype.eclipsecollections.EclipseCollectionsModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@@ -21,6 +20,7 @@ public class ForestsConfiguration {
|
||||
public ForestJacksonConverter forestJacksonConverter() {
|
||||
ForestJacksonConverter converter = new ForestJacksonConverter();
|
||||
converter.getMapper().registerModule(new EclipseCollectionsModule());
|
||||
converter.getMapper().registerModule(new JavaTimeModule());
|
||||
return converter;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user