Apply HATEOAS module to primary ObjectMapper

Update HypermediaAutoConfiguration to apply the Jackson2HalModule to
the primary ObjectMapper. This restores the behavior of Spring Boot
1.1 where HATEOAS types could be serialized for both `application/json`
and `application/json+hal` content types.

A `spring.hateoas.apply-to-primary-object-mapper` property has also been
provided to opt-out if necessary.

Fixes gh-2147
This commit is contained in:
Phillip Webb
2014-12-22 15:12:51 -08:00
parent ea84479e9a
commit fd97c7553c
4 changed files with 132 additions and 27 deletions

View File

@@ -96,6 +96,9 @@ content into your application; rather pick only the properties that you need.
spring.resources.cache-period= # cache timeouts in headers sent to browser
spring.resources.add-mappings=true # if default mappings should be added
# SPRING HATEOS ({sc-spring-boot-autoconfigure}/hateoas/HateoasProperties.{sc-ext}[HateoasProperties])
spring.hateoas.apply-to-primary-object-mapper=true # if the primary mapper should also be configured
# HTTP encoding ({sc-spring-boot-autoconfigure}/web/HttpEncodingProperties.{sc-ext}[HttpEncodingProperties])
spring.http.encoding.charset=UTF-8 # the encoding of HTTP requests/responses
spring.http.encoding.enabled=true # enable http encoding support