Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong URL with MvcUriComponentsBuilder::fromMethodCall in case of inheritance [SPR-13033] #17625

Closed
spring-issuemaster opened this issue May 15, 2015 · 2 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 15, 2015

Jean-Pierre Bergamin opened SPR-13033 and commented

MvcUriComponentsBuilder::fromMethodCall creates wrong URLs with derived controller classes, e.g.:

@RequestMapping("/something")
static class ControllerWithMethods {
	@RequestMapping("/else")
	HttpEntity<Void> myMethod(@RequestBody Object payload) {
		return null;
	}
}

@RequestMapping("/extended")
static class ExtendedController extends ControllerWithMethods {
		
}

UriComponents uriComponents = fromMethodCall(on(ExtendedController.class).myMethod(null)).build();

The URL that is built is http://localhost/something/else instead of http://localhost/extended/else.

The @RequestMapping of the declaring class of the method that is called is used instead of the @RequstMapping of the given controller class.


Affects: 4.1.6

Referenced from: commits 85cf4e6, e41877d

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 15, 2015

Jean-Pierre Bergamin commented

Please see #799

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 15, 2015

Jean-Pierre Bergamin commented

As mentioned in the PR. This also affects the fromMethod methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.