Framework:增加LocalDate、LocalTime序列化
This commit is contained in:
parent
bf0e7d2c77
commit
29b806e675
@ -1,18 +1,24 @@
|
|||||||
package cn.iocoder.yudao.framework.jackson.config;
|
package cn.iocoder.yudao.framework.jackson.config;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer;
|
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||||
import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeDeserializer;
|
import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeDeserializer;
|
||||||
import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer;
|
import cn.iocoder.yudao.framework.jackson.core.databind.LocalDateTimeSerializer;
|
||||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
import cn.iocoder.yudao.framework.jackson.core.databind.NumberSerializer;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -36,6 +42,10 @@ public class YudaoJacksonAutoConfiguration {
|
|||||||
simpleModule
|
simpleModule
|
||||||
.addSerializer(Long.class, NumberSerializer.INSTANCE)
|
.addSerializer(Long.class, NumberSerializer.INSTANCE)
|
||||||
.addSerializer(Long.TYPE, NumberSerializer.INSTANCE)
|
.addSerializer(Long.TYPE, NumberSerializer.INSTANCE)
|
||||||
|
.addSerializer(LocalDate.class, LocalDateSerializer.INSTANCE)
|
||||||
|
.addDeserializer(LocalDate.class, LocalDateDeserializer.INSTANCE)
|
||||||
|
.addSerializer(LocalTime.class, LocalTimeSerializer.INSTANCE)
|
||||||
|
.addDeserializer(LocalTime.class, LocalTimeDeserializer.INSTANCE)
|
||||||
.addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
|
.addSerializer(LocalDateTime.class, LocalDateTimeSerializer.INSTANCE)
|
||||||
.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
|
.addDeserializer(LocalDateTime.class, LocalDateTimeDeserializer.INSTANCE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user