Skip to content

BindingResult argument only resolved right after model attribute argument [SPR-4753] #9430

Description

@spring-projects-issues

Paul Middelkoop opened SPR-4753 and commented

Consider the following method signature:
@RequestMapping(params = "action=submitAndPreview", method = RequestMethod.POST)
public void submitAndPreview(
@SuppressWarnings("unused") @ModelAttribute(BasicController.ATTRIBUTE_ENTITY) Item item,
@ModelAttribute(ItemNodeController.ATTRIBUTE_NODE) ItemNode node,
@RequestParam("languageId") Integer languageId,
HttpSession session,
BindingResult result
Writer responseWriter) {

When calling thus methid I got the exception "java.lang.IllegalStateException: Errors/BindingResult argument declared without preceding model attribute. Check your handler method signature!"

After playing around with the method signature I noticed that the @RequestParam parameter results in this exception. When I remove this parameter or move it to the end of the parameter list it works.


Affects: 2.5.3

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions