Results 1 to 2 of 2

Thread: Using @Valid on multiple arguments

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Default 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 )

  2. #2

    Default

    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
  •