SHARE
TWEET

Untitled

a guest Jun 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Configuration
  2. public class AppConfig {
  3.  
  4.     @Bean
  5.     public JaxbAnnotationModule jaxbAnnotationModule() {
  6.         return new JaxbAnnotationModule();
  7.     }
  8.  
  9.     @Bean
  10.     public ObjectMapper objectMapper() {
  11.         ObjectMapper mapper = new ObjectMapper();
  12.         mapper.registerModule(new JaxbAnnotationModule());
  13.         mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector(mapper.getTypeFactory()));
  14.         mapper.setSerializationInclusion(Include.NON_NULL);
  15.         return mapper;
  16.     }
  17. }
  18.      
  19. @Autowired
  20. private Validator validator;
  21. ...Some code...
  22. Set<ConstraintViolation<Request>> violations = validator.validate(request);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top