Announcement Announcement Module
No announcement yet.
Spring validation framework applicability Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring validation framework applicability

    I am looking at feasibility of using Spring 3.1.0 validation framework to implement validation to all the API's that I have developed. In the service implementation layer, I need to add the validation to each of the service/functions in order to check if the passed params are valid and have correct values. What I found from initial investigation is that Spring's Validator Interface has to be implemented for each POJO's that I have.

    - But it may happen that for the given service, as in my case, that during validation one POJO's property value's validity may depend on another passed POJO's property value. So basically, service's POJO param's are valid or not, It can be interdependent.
    - Also, one POJO may have different validation logic in different services. May be I can allow one of it's property to be null in one case and not null in another cased for different services.

    Is there any way to use Spring Validation framework in this case. If yes, how?

  • #2

    I have moved this question over to the Spring Core forum, hope this is the right place for this question.



    • #3
      There is still a lot of work left to be done with it, but here is a link to our validation framework that we've created to solve several of the problems you are mentioning.

      Here we allow you to define "Rules" to validate any given condition (length, required, format, business rules, etc.) and apply them declaratively to fields on your beans. We have nested support so that rules can be executed only if another rule or condition passes. We support rule templating. And we can also apply rules not just to beans, but also to anything to request params, attributes, and even things residing in webflow scopes. These can all also be applied globally or conditionally based on url patterns or webflow states. Have a look and if you find it helpful or interesting, please pass it along.