-
Jan 27th, 2010, 01:25 PM
#1
Using @Valid on multiple arguments
Can you have the @Valid annotation on multiple arguments in an annotated method handler? Something like this:
public ModelView foo( @Valid @CustomAnnotation Bar arg1, BindingResult bindResultsArg1, @Valid @CustomAnnotation Bar arg2, BindingResult bindResultsArg2 )
-
Jan 27th, 2010, 05:07 PM
#2
Yes, this should work. The framework loops over each argument to the handler method, looking for annotations like @RequestParam, @RequestBody, @Valid, etc. and processes them (i.e. binds request parameters to them) one at a time. The validator should be called for each argument.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules