I've got all everything setup and everything works great using something like below.
@Controller
public class MyController {
@Autowired
private Validator validator;
@InitBinder
protected void initBinder(WebDataBinder binder) {
binder.setValidator(validator);
}
However, I've seen from the documentation that I could define a globalValidator
like below:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:mvc="http://ift.tt/1bHqwjR"
xmlns:xsi="http://ift.tt/ra1lAU"
xsi:schemaLocation="
http://ift.tt/GArMu6
http://ift.tt/1jdM0fG
http://ift.tt/1bHqwjR
http://ift.tt/1fmimld">
<mvc:annotation-driven validator="globalValidator"/>
</beans>
Question: How can I do it using Java configuration and no XML?
Aucun commentaire:
Enregistrer un commentaire