Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Validated should allow ElementType.METHOD target [SPR-9174] #13812

Closed
spring-projects-issues opened this issue Feb 27, 2012 · 2 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Feb 27, 2012

Dejan Predovic opened SPR-9174 and commented

@Validated is, at the moment, the only place where one can set a validation group for method-level validation, but different methods of the class typically need different validation groups. Imo, @Validated should work exactly like @Transactional - class level definition is fine, but one needs to be able to override it at the method level.


Affects: 3.1.1

Issue Links:

Referenced from: commits 5e3edc6

1 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

Damien Biggs commented

I 100% agree, I just spent a few hours digging around for this feature because I just assumed that it must be present.
The documentation insinuates that you can control method level validation groups with @Validated.
For that to work properly, we really need @Validated to allow ElementType.METHOD.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Spring-driven method validation supports an @Validated annotation at the method level now, with validation hints at that level overriding any class-level specifications. Composing custom annotations, using @Validated as a meta-annotation, works at both levels as well.

Note that an @Validated marker at the class level is nevertheless necessary to trigger method validation for a specific bean to begin with. Method-level use basically just allows for overriding validation groups.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants