0

spring.jackson.deserialization.wrap-exceptions=false i need this to convert to Bean while not implementing in Application.properties. I tried this but not working.

My reference link Spring Boot 1.4 Customize Internal Jackson Deserialization

@Bean 
    public Jackson2ObjectMapperBuilder objectMapperBuilder(){

        return Jackson2ObjectMapperBuilder.json().featuresToDisable(DeserializationFeature.WRAP_EXCEPTIONS) ;
    }
    

SpicySandwich
  • 49
  • 1
  • 10

1 Answers1

0

You have multiple options (it's weird if you want to use a custom one for Endpoint deserialization):

Override ObjectMapper

@Bean
@Primary
public ObjectMapper jsonMapper() {
    return new ObjectMapper();
}

Annotation (The working option for endpoints):

@JsonDeserialize(using = YourDeserializer.class)
public class YourClass {
}

Deserializer:

class YourDeserializer extends JsonDeserializer<YourClass> {
    @Override
    public YourClass deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
       // return YourClass instance;
    }
}

Take it in your own hands

You could just take a String and use your own ObjectMapper to deserialize the Object

Ausgefuchster
  • 1,091
  • 5
  • 14