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 {

    @GetMapping("/hello")
    public Mono<String> hello(@ModelAttribute(binding = false) User user) {
        return Mono.just(user.getName());
    }
}

... when I call http://localhost:8080/hello?name=xxxx , I get "xxxx" for WebFlux but "" for Web MVC.

Comment From: sbrannen

Thanks for raising your first issue against the Spring Framework!

It appears that we may need to add a check to org.springframework.web.reactive.result.method.annotation.ModelAttributeMethodArgumentResolver.resolveArgument(MethodParameter, BindingContext, ServerWebExchange) to honor the binding attribute in @ModelAttribute.

We will investigate our options.

Comment From: sbrannen

Current work on this can be viewed here: https://github.com/spring-projects/spring-framework/compare/main...sbrannen:issues/gh-26856-ModelAttribute-binding-false-WebFlux

Comment From: sbrannen

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).

Comment From: Wackerle

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 "xxxx" .

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 binding parameter is: 'Allows data binding to be disabled directly on an @ModelAttribute method parameter or on the attribute returned from an @ModelAttribute method, both of which would prevent data binding for that attribute. '

But it didn't actually take effect.