Skip to content

Instantly share code, notes, and snippets.

@yossale
Created April 21, 2019 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yossale/bafcab48520b9492fc53fc0b994d691e to your computer and use it in GitHub Desktop.
Save yossale/bafcab48520b9492fc53fc0b994d691e to your computer and use it in GitHub Desktop.
@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