
- 添加基础目录结构和文件 - 配置 Spring Boot 应用 - 添加数据库配置和 MyBatis 映射文件 - 实现简单的用户服务接口和仓库接口 - 添加日志配置和示例日志 - 配置 Docker 和 Docker Compose 文件 - 添加 Jackson 配置和工具类 - 实现简单的 API 测试用例
31 lines
1001 B
Java
31 lines
1001 B
Java
package com.in.trigger.config;
|
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.TimeZone;
|
|
|
|
/**
|
|
* Jackson配置类
|
|
*/
|
|
@Configuration
|
|
public class JacksonConfig {
|
|
|
|
/**
|
|
* 配置ObjectMapper
|
|
*/
|
|
@Bean
|
|
public ObjectMapper objectMapper() {
|
|
return Jackson2ObjectMapperBuilder.json()
|
|
.featuresToDisable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
|
|
.featuresToEnable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
|
|
.dateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"))
|
|
.timeZone(TimeZone.getDefault())
|
|
.build();
|
|
}
|
|
} |