Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support target instantiation and binding via constructor in DataBinder #26721

Closed
poutsma opened this issue Mar 24, 2021 · 1 comment
Closed
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@poutsma
Copy link
Contributor

poutsma commented Mar 24, 2021

Currently, both MVC's ModelAttributeMethodProcessor and WebFlux's ModelAttributeMethodArgumentResolver share similar (though not identical) code for instantiating beans from request parameters:

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.

@poutsma poutsma added in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement labels Mar 24, 2021
@poutsma poutsma added this to the 5.x Backlog milestone Mar 24, 2021
@rstoyanchev rstoyanchev changed the title Refactor attribute construction into reusable code Refactor model attribute construction into reusable code Mar 25, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Sep 23, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Sep 23, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Sep 23, 2021
poutsma added a commit to poutsma/spring-framework that referenced this issue Sep 23, 2021
@jhoeller jhoeller modified the milestones: 6.x Backlog, 6.0.x Nov 1, 2021
@jhoeller jhoeller modified the milestones: 6.0.x, 6.1.x Jan 11, 2023
@rstoyanchev rstoyanchev self-assigned this Jun 26, 2023
@rstoyanchev rstoyanchev modified the milestones: 6.1.x, 6.1.0-M2 Jun 26, 2023
@rstoyanchev rstoyanchev changed the title Refactor model attribute construction into reusable code Support for target instantiation and binding via constructor in DataBinder Jun 26, 2023
@rstoyanchev rstoyanchev changed the title Support for target instantiation and binding via constructor in DataBinder Support target instantiation and binding via constructor in DataBinder Jun 26, 2023
rstoyanchev added a commit that referenced this issue Jun 27, 2023
This provides more flexibility to pass a targetType even if
a MethodParameter is not available.

See gh-26721
@rstoyanchev
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants