Thursday, August 15, 2013

How to integrate Oval validation with Spring 3

The way I see it. If you are currently doing validation in a spring mvc application by implementing
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.




5 comments:

Pavel Co Ebele said...

Amazing & Great informative blog,it gives very useful practical information to developer like me. Besides that Wisen has established as Best Java Online Training India . or learn thru Online Training mode Java Online Training From India . Nowadays Hibernate ORM has tons of job opportunities on various vertical industry.

kevin antony said...

This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.
best rpa training in bangalore
rpa training in bangalore | rpa course in bangalore
RPA training in bangalore
rpa training in chennai
rpa online training

saimouni said...

All the points you described so beautiful. Every time i read your i blog and i am so surprised that how you can write so well.
Python training in bangalore
Python course in pune
Python training in bangalore

Ananya said...
This comment has been removed by the author.
Aishwariya said...

Thank you for sharing your info. I really appreciate your efforts and I am waiting for your next post thank you once again.
AWS certification course in Chennai

False fear

There is a figure they said She talks to me It's a mischievous voice I can't deny that love They say she is pretty Smart and wa...