Skip to content

Validator auto discovery not working for Spring Data Rest [DATAREST-524] #898

Open
@spring-projects-issues

Description

@spring-projects-issues

Daniel Moses opened DATAREST-524 and commented

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


34 votes, 37 watchers

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions