I have confiured annotation introspector (source)
public Jackson2ObjectMapperBuilderCustomizer addCustomBigDecimalDeserialization() {
return new Jackson2ObjectMapperBuilderCustomizer() {
@Override
public void customize(Jackson2ObjectMapperBuilder jacksonObjectMapperBuilder) {
jacksonObjectMapperBuilder.annotationIntrospector(
new JacksonAnnotationIntrospector() {
@Override
public JsonPOJOBuilder.Value findPOJOBuilderConfig(AnnotatedClass ac) {
if (ac.hasAnnotation(
JsonPOJOBuilder.class)) {//If no annotation present use default as empty prefix
return super.findPOJOBuilderConfig(ac);
}
return new JsonPOJOBuilder.Value("build", "");
}
}
);
}
};
}
And everything works until I added @EnableWebMvc
to Applciation
class. Now all dtos which have lombok @Value
and @Builder
annotations are fileld with nulls. It seems that my annotation introspector was replaced some where by spring. But where? Spring boot documentation said that it is enough to define Jackson2ObjectMapperBuilderCustomizer
bean.
Any ideas how configure/fix setting annotation introspectors with @EnableWebMvc
?
@EnableWebMvc
. Spring boot sets up spring mvc automatically without it. Similar problems discussed here and here. – Idoux