I spend a half of day to play with different settings.
So I manage to work it (1.3.2.RELEASE) when:
- I configure jackson in simple
@Configuration
annotated config class (not extended from WebMvcConfigurerAdapter
)
- I have NOT
@EnableWebMvc
Then Jackson2ObjectMapperBuilder objectMapperBuilder
solution is
work, but spring.jackson.serialization.indent_output: true
in properties ignored.
At last I finished with
@Autowired(required = true)
public void configeJackson(ObjectMapper objectMapper) {
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE)
.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
}
But all this is puzzle for me. I wrote a question about any explanation of all this magic in order to have some undestanding and solve problem not by
trial-and-error method: Are there any Spring Boot documentation for understanding how web mvc configuration is work?