Skip to content

Automatically register Jackson's JDK 8 module when available [SPR-12983] #17574

@spring-projects-issues

Description

@spring-projects-issues

Leon Radley opened SPR-12983 and commented

If I overwrite SpringBootRepositoryRestMvcConfiguration to enable some extra conf (simplified in the example below) the jsr-310 / jdk8 jackson modules are not being used

@Configuration
public class RestConfig extends SpringBootRepositoryRestMvcConfiguration {

    @Override
    protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
        config.setBasePath("/restapi");
        config.setReturnBodyOnCreate(true);
    }

}

As soon as I remove the RestConfig class the modules are in use and the dates come out right.

I've created a demo repo.
https://github.com/leon/temp-spring-boot-data-rest-jackson-problem

Another strange thing is that the JSR-310 module gets autoregistered, but the JDK8Module doesn't
so I need to add it explicitly?!

1. Solution

Can we somehow wait for the jackson auto configuration to complete before creating the rest object mapper, or even better why not use the same object mapper?


Affects: 4.1.6

Reference URL: spring-projects/spring-boot#2914

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions