-
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
@ModelAttribute(binding=false)
is not honored with WebFlux
#26856
Comments
Thanks for raising your first issue against the Spring Framework! It appears that we may need to add a check to We will investigate our options. |
@ModelAttribute(binding=false)
is not honored with WebFlux
Current work on this can be viewed here: main...sbrannen:issues/gh-26856-ModelAttribute-binding-false-WebFlux |
Prior to this commit, @ModelAttribute(binding=false) was honored with Spring Web MVC but not with WebFlux. This commit adds support for disabling binding via @ModelAttribute with WebFlux by adding a check to resolveArgument(...) in ModelAttributeMethodArgumentResolver. Closes gh-26856
This has been addressed, and the fix will be available in Spring Framework 5.2.15 and 5.3.7 (and their upcoming snapshot builds). |
Prior to this commit, @ModelAttribute(binding=false) was honored with Spring Web MVC but not with WebFlux. This commit adds support for disabling binding via @ModelAttribute with WebFlux by adding a check to resolveArgument(...) in ModelAttributeMethodArgumentResolver. Closes spring-projectsgh-26856
Prior to this commit, @ModelAttribute(binding=false) was honored with Spring Web MVC but not with WebFlux. This commit adds support for disabling binding via @ModelAttribute with WebFlux by adding a check to resolveArgument(...) in ModelAttributeMethodArgumentResolver. Closes spring-projectsgh-26856
I found a similar issue. Given... public class User {
private String name = "";
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
} And... @RestController
public class DemoController {
@ModelAttribute(binding = false)
public User user() {
return new User();
}
@GetMapping("/hello")
public Mono<String> hello(@ModelAttribute User user) {
return Mono.just(user.getName());
}
} when I call http://localhost:8080/hello?name=xxxx , I get The version I'm using: spring boot 2.6.6, spring framework 5.3.23. But I know from here that the the description of the But it didn't actually take effect. |
Given...
And...
... when I call http://localhost:8080/hello?name=xxxx , I get
"xxxx"
for WebFlux but""
for Web MVC.The text was updated successfully, but these errors were encountered: