E.g. let's say I had a domain class, a custom validator, and a controller kind of like this:
public class MyDomain { /*Stuff that I want to validate*/ } public class MyValidator extends LocalValidatorFactoryBean { /*Custom Validation Logic*/ } @RestController public class myController { @RequestMapping(path = "/myDomain", method=RequestMethod.POST) public void doStuff(@RequestBody @Validated MyDomain myDomain){ //Do stuff. } } How do I make it so that when validation happens on @Validated MyDomain myDomain that MyValidator is used?
Also, can I use a subclass of org.springframework.validation.beanvalidation.LocalValidatorFactoryBean for this or do I need to implement org.springframework.validation.Validator?