Commit 0c2ecb7b authored by Andy Wilkinson's avatar Andy Wilkinson

Apply standard Jackson2ObjectMapperBuilder config via a customizer

This commit builds on the new abstraction introduced in 2a0b8a7 by
applying the standard JacksonProperties-based
Jackson2ObjectMapperBuilder configuration via a customizer.

It also applies some polishing to the original contribution:

 - Code has been formatted
 - Logic that applies the customizers has moved to be alongside the code
   that creates the builder
 - Logic that explicitly sorted the customisers has been removed as
   they will be sorted automatically prior to injection
parent deb7529a
......@@ -17,6 +17,7 @@
package org.springframework.boot.autoconfigure.jackson;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
/**
......@@ -29,9 +30,9 @@ import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
*/
public interface Jackson2ObjectMapperBuilderCustomizer {
/**
* Customize the jacksonObjectMapperBuilder.
* @param jacksonObjectMapperBuilder the jacksonObjectMapperBuilder to customize
*/
void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder);
/**
* Customize the jacksonObjectMapperBuilder.
* @param jacksonObjectMapperBuilder the jacksonObjectMapperBuilder to customize
*/
void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder);
}
......@@ -527,7 +527,8 @@ public class JacksonAutoConfigurationTests {
public Jackson2ObjectMapperBuilderCustomizer customDateFormat() {
return new Jackson2ObjectMapperBuilderCustomizer() {
@Override
public void customize(Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
public void customize(
Jackson2ObjectMapperBuilder jackson2ObjectMapperBuilder) {
jackson2ObjectMapperBuilder.dateFormat(new MyDateFormat());
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment