Skip to content

Missing documentation on how to set up JSR-303 method validation [SPR-11473] #16098

@spring-projects-issues

Description

@spring-projects-issues

Abhijit Sarkar opened SPR-11473 and commented

The part of the reference manual that talks about integration with JSR-303 conveniently omits two things, without which BV does not kick in.

  1. A MethodValidationPostProcessor needs to be configured in addition to the LocalValidatorFactoryBean.
  2. The class to be validated must have a @Validated annotation on it else methods are NOT searched for inline constraint annotations.

This just caused me 6 hours of debugging and hair tearing where I did everything the doc said but BV would simply not kick in. I finally had to debug through the Spring source code to understand this. There got to be an easier way and I can't be the only one who had this problem.


Affects: 4.0.2

Reference URL: http://docs.spring.io/spring/docs/4.0.x/spring-framework-reference/html/validation.html

Referenced from: commits 9af7d26

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions