remove gson
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
package com.imyeyu.api.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.imyeyu.utils.Time;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
/**
|
||||
* @author 夜雨
|
||||
@@ -10,7 +15,17 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class BeanConfig {
|
||||
|
||||
public Gson gson() {
|
||||
return new Gson();
|
||||
@Bean
|
||||
public ObjectMapper jackson() {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setDateFormat(Time.dateTime);
|
||||
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Yaml yaml() {
|
||||
return new Yaml();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user