Class ModelAttributeMethodProcessor

All Implemented Interfaces:
HandlerMethodArgumentResolver, HandlerMethodReturnValueHandler
Direct Known Subclasses:

public class ModelAttributeMethodProcessor extends Object implements HandlerMethodArgumentResolver, HandlerMethodReturnValueHandler
Resolve @ModelAttribute annotated method arguments and handle return values from @ModelAttribute annotated methods.

Model attributes are obtained from the model or created with a default constructor (and then added to the model). Once created the attribute is populated via data binding to Servlet request parameters. Validation may be applied if the argument is annotated with @jakarta.validation.Valid. or Spring's own @org.springframework.validation.annotation.Validated.

When this handler is created with annotationNotRequired=true any non-simple type argument and return value is regarded as a model attribute with or without the presence of an @ModelAttribute.

Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze, Vladislav Kisel
  • Field Details

    • logger

      protected final Log logger
  • Constructor Details

    • ModelAttributeMethodProcessor

      public ModelAttributeMethodProcessor(boolean annotationNotRequired)
      Class constructor.
      annotationNotRequired - if "true", non-simple method arguments and return values are considered model attributes with or without a @ModelAttribute annotation
  • Method Details