I have added <mvc:annotation-driven/>
to my Spring configuration, and according to the documentation it will provide:
Support for validating @Controller inputs with @Valid, if a JSR-303 Provider is present on the classpath. The validation system can be explicitly configured by setting the validator attribute.
From this and other documents, I have taken it to mean that I no longer need to explicitly inject a validator within my controller classes and it will be done automatically. Is this correct?
Currently I need to have the following in my controller:
@Autowired
private Validator validator;
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.setValidator(validator);
}
Can anyone clear this up for me? Thanks