dimanche 28 juin 2015

Valid cannot be resolved to a type Spring 4.0.3

I am facing the issue that @Valid annotation cannot be resolved, though i have added the dependency , configured pom.xml and Default-servlet.xml

Please find the codes below:

@RequestMapping(value = "/", method = RequestMethod.POST)
    public String loginProcess(@ModelAttribute("user") @Valid User userToBeValidated,BindingResult result , HttpServletRequest request){

pom.xml

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.3.1.Final</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>   

DefaultServlet-servlet.xml

<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />

Any help is highly appreciated. Thanks in advanceenter image description here

Aucun commentaire:

Enregistrer un commentaire