feature(configuration,forest): 增加 jackson LocalDatetime 等Java时间类型适配

This commit is contained in:
2023-06-14 15:18:52 +08:00
parent 3ded854480
commit 437b2188b7
2 changed files with 4 additions and 2 deletions

View File

@@ -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());
};
}
}

View File

@@ -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;
}