Pergunta

I try to use @Valid annotation, but eclipse always gives the "Valid cannot be resolved to a type" error. I m using the spring3 library.

I have imported hibernate-validator-4.1.0.Final.jar into my WEB-INF/lib directory. however, this does not solve the problem.

Any help is appreciated!

Foi útil?

Solução

As far as I remember the @Valid annotation is part of the validation-api JAR which you can find in the lib directory of the Hibernate Validator, as you have already downloaded the Hibernate implementation. The @Valid is a part of the javax.validation annotation API. You can add this JAR to your class path to be able to properly reference the annotation.

Outras dicas

@Valid belongs to JSR-303. You can get it via maven using this dependency:

<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
</dependency>

Or you can download it from this page.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top