Skip to content

HandlerMethodResolver does not handle hierarchy of generic interfaces with @MVC annotations [SPR-7355] #11985

Closed
@spring-projects-issues

Description

@spring-projects-issues

Richard Larson opened SPR-7355 and commented

Given the following type of construct 2 problems arise:

  1. the bridged methods do not get matched and thus we get "HTTP Status 405 - Request method 'POST' not supported", for the update method.

2)The @ModelAttribute ("note") annotation on the loadModel method is not picked up from the interface.

We are using standard Spring WebMVC annotation driven setup (<mvc:annotation-driven /> and <aop:config proxy-target-class="true">) with Hibernate JPA models.

This may be related to a previous issue:
http://jira.springframework.org/browse/SPR-5191?page=com.atlassian.jirafisheyeplugin%3Acrucible-issuepanel

public interface ModelController<Model> {
	@ModelAttribute("note")
	public Model loadModel(@RequestParam(required = false) Long id);

	@InitBinder
	public void initBinder(WebDataBinder binder);
}
public interface EditableController<Model> extends ModelController<Model> {

	@RequestMapping (method = RequestMethod.POST )
	public String update(@Valid @ModelAttribute("note") Model command,
			BindingResult result);

	@RequestMapping(method = RequestMethod.GET)
	public void edit(@RequestParam Long id);
}
@Controller
public class PersonController implements EditableController<Person> {
	public void edit(Long id) {...}

	public String update(Person command, BindingResult result) {...}

	public void initBinder(WebDataBinder binder) {...}

	public Person loadModel(Long id) {...}

}

Affects: 3.0.2, 3.0.3

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions