Merge branch '1.1.x'
This commit is contained in:
commit
6cfd6cad64
|
@ -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());
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Reference in New Issue