Overview
Although ModelMap is not officially supported as an argument type for a WebFlux controller method, it still possible for a user to accidentally attempt to use ModelMap instead of Model or Map.
If ModelMap is used, the user currently encounters an exception similar to the following.
java.lang.IllegalStateException: argument type mismatch
Controller [org.springframework.web.reactive.config.WebFluxViewResolutionIntegrationTests$SampleController]
Method [java.lang.String org.springframework.web.reactive.config.WebFluxViewResolutionIntegrationTests$SampleController.index(org.springframework.ui.ModelMap)] with argument values:
[0] [type=org.springframework.validation.support.BindingAwareConcurrentModel] [value={}]
The above 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.
Thus, we should improve diagnostics for the user in such scenarios by rejecting the use of ModelMap upfront in the ModelMethodArgumentResolver in WebFlux.
Related Issues
Overview
Although
ModelMapis not officially supported as an argument type for a WebFlux controller method, it still possible for a user to accidentally attempt to useModelMapinstead ofModelorMap.If
ModelMapis used, the user currently encounters an exception similar to the following.The above is a bit cryptic since the error occurs while attempting to invoke the controller method with an instance of
BindingAwareConcurrentModelwhich is not compatible withModelMap.Thus, we should improve diagnostics for the user in such scenarios by rejecting the use of
ModelMapupfront in theModelMethodArgumentResolverin WebFlux.Related Issues
ModelMapis not a supported argument type in WebFlux #33107