-
Notifications
You must be signed in to change notification settings - Fork 37.7k
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
Document feature to load @ModelAttribute
through type conversion from a request value
#26873
Comments
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference. |
Out of curiosity, why are you using |
@ModelAttribute
in WebFlux does not bind an HTTP GET parameter
I didn't use @ModelAttribute on string in my work.It's just that when I was learning spring, I found that webflux and webmvc have some behavioral differences.Webmvc will handle UrlParam, but Webflux will not, so this question was raised. |
@ModelAttribute
in WebFlux does not bind an HTTP GET parameter@ModelAttribute
in WebFlux does not bind an HTTP query parameter
Thanks for providing the explanation.
Indeed it is... your first GitHub issue ever. Congratulations!
Oh, no. It's not bad at all. I was merely wondering what your use case was for using In any case, we will investigate the cause for the different behavior. |
@aoyvx, this is an extra feature in Spring MVC where the model attribute can be loaded through a converter. A typical example might look like this: @PostMapping("/{account}")
public String update(@Valid @ModelAttribute("account") Account account, BindingResult result) {
// ...
} Note that the model attribute name "account" matches the name of a request value (in this case a path variable). When this is the case and there is a I have realized that this not documented in the reference docs, which we can address. The same feature currently does not exist in WebFlux. |
@ModelAttribute
in WebFlux does not bind an HTTP query parameter@ModelAttribute
through type conversion from a request value
The behavior of
@ModelAttribute
in Web MVC and WebFlux is different.Except for #26856, the HTTP GET parameter cannot be bound normally.
In WebFlux and Web MVC 5.3.4 :
when I call http://localhost:8080/echo?msg=hello, I get `` for WebFlux but
hello
for Web MVC.The text was updated successfully, but these errors were encountered: