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

Allow custom @Validated annotations for handler method parameters [SPR-12406] #17014

Closed
spring-projects-issues opened this issue Nov 1, 2014 · 2 comments
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 Nov 1, 2014

Vadim opened SPR-12406 and commented

Extend @Validated with Target.Annotation allowing the creation of custom @Validated annotations.

The result will be:
public boolean registerNewUser(@RegisterValid @RequestBody User newUser) {

instead of

public boolean registerNewUser(@Validated({Default.class, RegisterGroup.class,VIP.class....}) @RequestBody User newUser) {


Affects: 4.0.7, 4.1.1

Issue Links:

Referenced from: commits 929cda6

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Declaring custom @Validated annotations works already, since the TYPE argument includes ANNOTATION_TYPE anyway. Using such custom validating annotations at the type level, e.g. for method validation, works as well. However, the check at the handler method parameter level seems to be too restrictive; I'll revise this for 4.1.3, finally closing that gap.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Resolved through an explicit meta-annotation lookup for @Validated in all applicable places. This will be available in the next 4.1.3 snapshot; feel free to give it an early try...

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