How do I create a Jackson Customizer for jackson-datatype-money in Spring Boot?

Viewed 1189

I am having an issue with this Spring Boot customizer for Jackson. Debugging it appears to be configured, but Jackson is not using the model during (de)serialization.

import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.stereotype.Component;
import org.zalando.jackson.datatype.money.MoneyModule;


@Component
public class JacksonMoneyDatatypeCustomizer implements Jackson2ObjectMapperBuilderCustomizer {

    @Override
    public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
        jacksonObjectMapperBuilder.modulesToInstall(new MoneyModule());
    }
}

Is this the correct way to solve this?

1 Answers
Related