Class ModelAttributeMethodProcessor

java.lang.Object
org.springframework.web.method.annotation.ModelAttributeMethodProcessor
All Implemented Interfaces:
HandlerMethodArgumentResolver, HandlerMethodReturnValueHandler
Direct Known Subclasses:
ServletModelAttributeMethodProcessor

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.

Since:
3.1
Author:
Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze, Vladislav Kisel
  • Field Details

    • logger

      protected final Log logger
  • Constructor Details

    • ModelAttributeMethodProcessor

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