Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-11473

Missing documentation on how to set up JSR-303 method validation

    XMLWordPrintable

    Details

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            asarkar Abhijit Sarkar
            Last updater:
            Spring Issuemaster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 25 weeks, 1 day ago