From 07b73661660ee7ebe5c914df4096b341b9fdbd27 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Thu, 15 Apr 2021 16:27:41 +0800 Subject: [PATCH] =?UTF-8?q?IOT=E8=B0=83=E7=94=A8=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../iotgateway/config/JacksonConfig.java | 61 ------------------- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 src/main/java/com/telpo/iotgateway/config/JacksonConfig.java diff --git a/pom.xml b/pom.xml index f4602e0..497c436 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ iotgatewayservice 1.0-SNAPSHOT iot-gateway-server - 数据推送服务 + IOT测试服务 jar UTF-8 diff --git a/src/main/java/com/telpo/iotgateway/config/JacksonConfig.java b/src/main/java/com/telpo/iotgateway/config/JacksonConfig.java deleted file mode 100644 index e690110..0000000 --- a/src/main/java/com/telpo/iotgateway/config/JacksonConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.telpo.iotgateway.config; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; -import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; -import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer; -import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; -import models.Constants; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.format.DateTimeFormatter; - -/** - * @program: DataPushServer - * @description: 序列化设置 - * @author: linwl - * @create: 2020-07-11 09:15 - */ -@Configuration -public class JacksonConfig { - - @Bean - public ObjectMapper objectMapper() { - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - objectMapper.disable(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE); - JavaTimeModule javaTimeModule = new JavaTimeModule(); - javaTimeModule.addSerializer( - LocalDateTime.class, - new LocalDateTimeSerializer( - DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_TIME_FORMAT))); - javaTimeModule.addSerializer( - LocalDate.class, - new LocalDateSerializer(DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_FORMAT))); - javaTimeModule.addSerializer( - LocalTime.class, - new LocalTimeSerializer(DateTimeFormatter.ofPattern(Constants.DEFAULT_TIME_FORMAT))); - javaTimeModule.addDeserializer( - LocalDateTime.class, - new LocalDateTimeDeserializer( - DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_TIME_FORMAT))); - javaTimeModule.addDeserializer( - LocalDate.class, - new LocalDateDeserializer(DateTimeFormatter.ofPattern(Constants.DEFAULT_DATE_FORMAT))); - javaTimeModule.addDeserializer( - LocalTime.class, - new LocalTimeDeserializer(DateTimeFormatter.ofPattern(Constants.DEFAULT_TIME_FORMAT))); - objectMapper.registerModule(javaTimeModule).registerModule(new ParameterNamesModule()); - return objectMapper; - } -}