What is the best way to validate incoming json data using Jackson in Spring boot?

69 views Asked by At

I am using spring boot v 2.7.1 with Java 17. I define how data structure should look like in xsd. Then I use xjc to convert it to Java classes. The xjc markers mandatory elements with annotation @XmlElement(required = true) I need to validate these elements when deserialising with Jackson into Java classes. What’s the best and the easiest to do it? Jackson deserialise json message.

I’ve tried this bean to enable spring boot to register the annotations.

@Bean
public Module jaxbModule(){
 return new JaxbAnnotationModule();
}
0

There are 0 answers