Results 1 to 3 of 3

Thread: @Valid location

  1. #1
    Join Date
    Jan 2008
    Posts
    24

    Default @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. #2
    Join Date
    Jul 2010
    Location
    Venice, Italy
    Posts
    709

    Default

    @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. #3

    Default

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •