当前位置: 动力学知识库 > 问答 > 编程问答 >

hibernate - Spring Validation using @Validated

问题描述:

We have a rest application based on jersey and hibernate for bean validation which gets triggered by javax.validation.Valid @Valid

annotation.This will validate all the fields that is configured with a constraint.

Now we are looking to implement conditional validation where validate only specific fields when a specific operation is called and have tried org.springframework.validation.annotation.Validated @Validated(<<Group.class>>)

But the problem is the hibernate validation is not getting triggered through the @Validated annotation.

Please let me know if any solution available for the problem

services.xml

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

<bean class="org.springframework.validation.beanvalidation.MethodValidationPostProcessor"/>

Pom.xml

<hibernate-validator.version>5.2.4.Final</hibernate-validator.version>

<spring.version>4.2.4.RELEASE</spring.version>

分享给朋友:
您可能感兴趣的文章:
随机阅读: