Skip to content

if overriding SpringBootRepositoryRestMvcConfiguration jackson extra modules are not used #2914

@leon

Description

@leon

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?!

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions