Announcement Announcement Module
No announcement yet.
@Valid location Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • @Valid location

    I'm trying to add @Valid to a @Controller using Spring 3.0.5. I read the docs and wrote my own validator and downloaded Hibernate Validator (and added it to my project). My problem is that as soon as I add @Valid to my method, eclipse can't find it. What jar is this annotation found in?

    I have nearly all of the Spring 3.0.5 jars included in the project already.

  • #2
    @Valid is a JSR-303 annotation and part of the Bean Validation API, and as such is not distributed with Spring. You will need to download and add the JSR-303 Bean Validation API jar (or add the dependency if you use Maven or Ivy).

    Also be aware that @Valid has nothing to do with custom Spring validators, and its usage does not require that you implement custom validators. I suggest you to take a look at the Spring official reference documentation for the usage of JSR's @Valid to validate MVC Controller input.


    • #3
      I'm using the @Valid annotation and the containing jar file is validation-api.1.0.0.GA (get it from maven repo)