Merge branch '1.1.x'

This commit is contained in:
Andy Wilkinson 2014-11-18 13:16:45 +00:00
commit 6cfd6cad64
2 changed files with 26 additions and 0 deletions

View File

@ -113,6 +113,10 @@ public class JacksonAutoConfiguration {
if (isJsonSortKeys != null && isJsonSortKeys) {
builder.featuresToEnable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
}
Boolean isJsonPrettyPrint = this.httpMapperProperties.isJsonPrettyPrint();
if (isJsonPrettyPrint != null && isJsonPrettyPrint) {
builder.featuresToEnable(SerializationFeature.INDENT_OUTPUT);
}
configureFeatures(builder, this.jacksonProperties.getDeserialization());
configureFeatures(builder, this.jacksonProperties.getSerialization());
configureFeatures(builder, this.jacksonProperties.getMapper());

View File

@ -354,6 +354,28 @@ public class JacksonAutoConfigurationTests {
DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES));
}
@Test
public void httpMappersJsonPrettyPrintIsApplied() {
this.context.register(JacksonAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context,
"http.mappers.json-pretty-print:true");
this.context.refresh();
ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class);
assertTrue(objectMapper.getSerializationConfig().isEnabled(
SerializationFeature.INDENT_OUTPUT));
}
@Test
public void httpMappersJsonSortKeysIsApplied() {
this.context.register(JacksonAutoConfiguration.class);
EnvironmentTestUtils.addEnvironment(this.context,
"http.mappers.json-sort-keys:true");
this.context.refresh();
ObjectMapper objectMapper = this.context.getBean(ObjectMapper.class);
assertTrue(objectMapper.getSerializationConfig().isEnabled(
SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS));
}
@Configuration
protected static class ModulesConfig {