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:
@@ -75,19 +75,17 @@ public class HypermediaAutoConfigurationTests {
|
||||
|
||||
@Test
|
||||
public void doesBackOffIfEnableHypermediaSupportIsDeclaredManually() {
|
||||
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(SampleConfig.class, HypermediaAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
|
||||
this.context.getBean(LinkDiscoverers.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jacksonConfigurationIsAppliedToTheHalObjectMapper() {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(HypermediaAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class);
|
||||
this.context.register(JacksonAutoConfiguration.class,
|
||||
HypermediaAutoConfiguration.class);
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.jackson.serialization.INDENT_OUTPUT:true");
|
||||
this.context.refresh();
|
||||
|
||||
Reference in New Issue
Block a user