spring.jackson.serialization.indent-output
doesn't work with Spring Boot 2.3.0.M2. I confirmed that it works with Spring Boot 2.3.0.M1.
This is a sample project to reproduce it: https://github.com/izeye/spring-boot-throwaway-branches/tree/spring-boot-2.3.0.M2-jackson-indent-output
And this is a sample endpoint to check: http://localhost:8080/persons
Comment From: wilkinsona
Thanks for the sample, Johnny. It works as expected with M2 if you remove the Actuator dependency. My guess is that the Actuator-specific ObjectMapper
(https://github.com/spring-projects/spring-boot/issues/12951) is getting involved when it should not be.
Comment From: wilkinsona
Using curl to access http://localhost:8080/persons, ActuatorJsonHttpMessageConverter.canWrite(Type, Class, MediaType)
is called with java.util.List<com.izeye.throwaway.Person>
, java.util.ArrayList
, null
. This results in a call to org.springframework.http.converter.AbstractHttpMessageConverter.canWrite(MediaType)
with null
and it returns true
:
if (mediaType == null || MediaType.ALL.equalsTypeAndSubtype(mediaType)) {
return true;
}
Comment From: wilkinsona
Another side-effect is that we serve a application/vnd.spring-boot.actuator.v3+json
response:
$ curl http://localhost:8080/persons -i
HTTP/1.1 200
Content-Type: application/vnd.spring-boot.actuator.v3+json
Transfer-Encoding: chunked
Date: Tue, 18 Feb 2020 09:54:53 GMT
[{"firstName":"Johnny","secondName":"Lim"}]
Comment From: bclozel
I've reopened #12951 and created #20290. I'm closing this issue as it's superseded by those.
Comment From: wilkinsona
We need something in the M3 release notes to indicate that the regression's been fixed. I think we should use this issue to do that.
Comment From: wilkinsona
Fixed by https://github.com/spring-projects/spring-boot/commit/ab72cc8fdbc55adf54a8c33371b77e7f8d9782e1 which reverted the first attempt at providing an Actuator-specific ObjectMapper
.