You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Prior to this commit, if ModelMap was used as an argument type in a
WebFlux controller method, the user encountered an exception similar to
the following.
java.lang.IllegalStateException: argument type mismatch
Controller [example.SampleController]
Method [java.lang.String example.SampleController.index(org.springframework.ui.ModelMap)] with argument values:
[0] [type=org.springframework.validation.support.BindingAwareConcurrentModel] [value={}]
However, the above error message is a bit cryptic since the error
occurs while attempting to invoke the controller method with an
instance of BindingAwareConcurrentModel which is not compatible with
ModelMap. More importantly, this error message does not explicitly
convey to the user that a ModelMap is not supported.
This commit improve the diagnostics for the user in such scenarios by
rejecting the use of ModelMap upfront in WebFlux.
Consequently, for the same use case as above, the user now encounters
an exception similar to the following.
java.lang.IllegalStateException:
Could not resolve parameter [0] in
java.lang.String example.SampleController.index(org.springframework.ui.ModelMap):
No suitable resolver
Closesgh-33109
Copy file name to clipboardExpand all lines: spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelAttributeMethodArgumentResolver.java
+8-5
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2002-2023 the original author or authors.
2
+
* Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: spring-webflux/src/main/java/org/springframework/web/reactive/result/method/annotation/ModelMethodArgumentResolver.java
+14-9
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2002-2019 the original author or authors.
2
+
* Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
Copy file name to clipboardExpand all lines: spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/ModelMethodArgumentResolverTests.java
0 commit comments