Uploaded image for project: 'Spring Data REST'
  1. Spring Data REST
  2. DATAREST-524

Validator auto discovery not working for Spring Data Rest

    XMLWordPrintable

    Details

      Description

      See documentation
      http://docs.spring.io/spring-data/rest/docs/2.2.2.RELEASE/reference/html/#validation-chapter

      Discovery should happen with Validator Prefix. Add a Validator bean to the context and notice that it does not get auto-detected. Manual wiring still works. Here is an example validator that will not work if included in the example Spring boot project:

          @Component("beforeCreatePersonValidator")
          public class BeforeCreatePersonValidator implements Validator {
              @Override
              public boolean supports(Class<?> clazz) {
                  return Person.class.equals(clazz);
              }
              
              @Override
              public void validate(Object target, Errors errors) {
                  errors.reject("TESTING");
              }
          }
      

      See problem as reported:
      http://stackoverflow.com/questions/24318405/spring-data-rest-validator

        Attachments

          Activity

            People

            Assignee:
            olivergierke Oliver Drotbohm
            Reporter:
            dmoses Daniel Moses
            Last updater:
            Servan Fichet
            Votes:
            34 Vote for this issue
            Watchers:
            37 Start watching this issue

              Dates

              Created:
              Updated: