32 lines
804 B
Java
32 lines
804 B
Java
package com.imyeyu.api.config;
|
|
|
|
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 夜雨
|
|
* @since 2025-05-16 18:53
|
|
*/
|
|
@Configuration
|
|
public class BeanConfig {
|
|
|
|
@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();
|
|
}
|
|
}
|