|
@@ -1,11 +1,19 @@
|
|
|
package fcb.project.manager;
|
|
|
|
|
|
+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.LocalDateTimeDeserializer;
|
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
|
|
|
/**
|
|
|
* @author abnerhou
|
|
@@ -19,6 +27,20 @@ import org.springframework.context.annotation.Bean;
|
|
|
@MapperScan(basePackages = {"fcb.project.manager.base.dao"})
|
|
|
public class FcbProjectManagerApplication {
|
|
|
|
|
|
+ @Bean
|
|
|
+ public ObjectMapper serializingObjectMapper() {
|
|
|
+ JavaTimeModule module = new JavaTimeModule();
|
|
|
+ LocalDateTimeDeserializer localDateTimeDeserializer =
|
|
|
+ new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
+ module.addDeserializer(LocalDateTime.class, localDateTimeDeserializer);
|
|
|
+ ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json()
|
|
|
+ .modules(module)
|
|
|
+ .featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
|
+ .build();
|
|
|
+ return objectMapper;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
SpringApplication springApplication = new SpringApplication(FcbProjectManagerApplication.class);
|