You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are two MappingJackson2HttpMessageConverters registered with Spring MVC, both of which have the same supported media types. I don't understand why we need two.
If you have Spring Data REST on the classpath, HypermediaAutoConfiguration gets switched off which means that spring.hateoas.apply-to-primary-object-mapper has no effect.
If you have Spring Data REST on the classpath, I believe that Spring HATEOAS's ObjectMapper is created before JacksonAutoConfiguration runs. This means that HATEOAS's ObjectMapper becomes the only auto-configured ObjectMapper, but it isn't annotated @Primary.
We should try to move away from using Jackson2HalModule and its handler instantiator directly as @olivergierke considers them to be private API.
Some goals:
spring.jackson.* properties should take effect irrespective of what's on the classpath.
When Spring HATEOAS or Spring Data REST are on the classpath, spring.jackson.* should affect their ObjectMapper(s)
When Spring HATEOAS is on the classpath, HAL-formatted responses should be sent in response to requests that accept application/json (HAL not set as default in 1.2.0 #2147)
The two MappingJackson2HttpMessageConverters is due to a design decision in HttpMessageConverters. It deliberately retains any default converters that duplicate the Spring Boot-specific converters, but positions the default later in the list. I don't intend to address this as part of this issue.
Some observations:
MappingJackson2HttpMessageConverters
registered with Spring MVC, both of which have the same supported media types. I don't understand why we need two.spring.hateoas.apply-to-primary-object-mapper
has no effect.ObjectMapper
is created beforeJacksonAutoConfiguration
runs. This means that HATEOAS'sObjectMapper
becomes the only auto-configuredObjectMapper
, but it isn't annotated@Primary
.Jackson2HalModule
and its handler instantiator directly as @olivergierke considers them to be private API.Some goals:
spring.jackson.*
properties should take effect irrespective of what's on the classpath.spring.jackson.*
should affect theirObjectMapper(s)
application/json
(HAL not set as default in 1.2.0 #2147)spring.jackson.*
, irrespective of whether or not Spring HATEOAS and Spring Data REST are on the classpath. (Spring-boot-starter-data-rest prevents JSON pretty print in actuator. #1729)The text was updated successfully, but these errors were encountered: