Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  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);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement