Currently, both MVC's ModelAttributeMethodProcessor
and WebFlux's ModelAttributeMethodArgumentResolver
share similar (though not identical) code for instantiating beans from request parameters:
- MVC's
ModelAttributeMethodProcessor::constructAttribute
- WebFlux's
ModelAttributeMethodArgumentResolver::constructAttribute
We should try to refactor this code into something usable from both MVC and WebFlux, and which can also be used from WebMvc.fn and WebFlux.fn in the future.
Comment From: rstoyanchev
DataBinder
now provides construct
method to create the target object via constructor initialization. Likewise ServletRequestDataBinder
and WebExchangeDataBinder
provide the same, to bind from an HTTP request to constructor arguments.
Technically a refactoring of existing functionality in the classes referenced in the description, but integrated into the DataBinder
hierarchy along with further enhancements for #20806 and #22748.