interface Validator undestanding spring oval intergration is supper easy. Anyway it doesn't matter you have any experiance on that or not you will understand how spring oval intergration can do at with this tutorial.
- Oval what is oval?
- Oval validation
- spring support
- oval class API
Need of a validator interface
public interface Validator {
boolean supports(Class clazz);
void validate(Object target, Errors errors);
}
Spring API to validate
Add this to your bean configuration file. Replace the highlighted configuration files with your ones.
<bean id="validator" class="net.sf.oval.integration.spring.SpringValidator">
<constructor-arg>
<bean id="validator" class="net.sf.oval.Validator">
<constructor-arg>
<util:list>
<bean class="net.sf.oval.configuration.xml.XMLConfigurer">
<constructor-arg>
<value type="java.io.InputStream">classpath:com/test/validation/oval1-config.xml</value>
</constructor-arg>
</bean>
<bean class="net.sf.oval.configuration.xml.XMLConfigurer">
<constructor-arg>
<value type="java.io.InputStream">classpath:com/test/validation/oval2-config.xml</value>
</constructor-arg>
</bean>
</util:list>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
The class net.sf.oval.integration.spring.SpringValidator provides an implementation of Spring's org.springframework.validation.Validatorinterface and thus can be used for Spring Validation.