Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Configuration
public class AppConfig {
private static final String dateFormat = "yyyy-MM-dd";
private static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss";
@Bean
public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() {
return builder -> {
builder.serializers(new LocalDateTimeSerializer(
DateTimeFormatter.ofPattern(DATE_TIME_FORMAT)));
builder.serializers(new LocalDateSerializer(
DateTimeFormatter.ofPattern(DATE_FORMAT)));
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment