-
Notifications
You must be signed in to change notification settings - Fork 38.2k
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
@RequestMapping without @Controller registered as handler [SPR-17622] #22154
Comments
Sébastien Deleuze commented I understand the rationale behind what you ask, but class level Rossen Stoyanchev Arjen Poutsma Could you share your point of view on this change request? |
Eugene Tenkaev commented Sébastien Deleuze I have edit description the idea is next: My example shows that: |
Sébastien Deleuze commented I understand, but what I wanted to clarify is that
I understand your request for being more restrictive in how we identify REST endpoints, and the issue raised for |
Class level @jhoeller do you see any options to refine the checks, e.g. if type-level Note also that Spring Data REST has a similar situation for REST endpoints, and it solves that through an additional |
This issue leads to a lot of different problems that are very hard to debug. Please fix it. I can suggest these solutions:
I'd suggest implementing the first solution. |
regist handler and regist requestmapping |
This issue is still relevant. Any progress with that? |
Copying the description of #25386 here for reference: tl;dr – The current behavior is problematic for folks trying to customize Spring Data REST using custom controllers, too, as it subtley makes controllers using Rossen mentioned that here already, but it just recently came up in StackOverflow questions again.
|
Just get this issue with a feign client and spent a lot of hours to locate it. Is someone on that issue ? |
This just came up in yet another Spring Data REST issue: https://jira.spring.io/browse/DATAREST-1591. |
Team Decision: after some cross-team discussions, for the short term the issue will be addressed on the side of Spring Data REST and Spring Cloud. For Spring Framework 6.0, we will also address this in the Spring Framework by no longer considering a class with a type-level |
@rstoyanchev do you know if there is a corresponding ticket in Spring Cloud that can be subscribed to? |
@remal, yes you can follow here spring-cloud/spring-cloud-openfeign#547. |
See spring-projectsgh-22154 which removed support for a type-level @RequestMapping annotation alone being sufficient for handler detection.
See gh-22154 which removed support for a type-level @RequestMapping annotation alone being sufficient for handler detection. Closes gh-28448
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
…ted annotations adding @RestController annotations on controllers and fixing ordering, for details see: spring-projects/spring-framework#22154
Just to note that the previous behaviour allowed declaring and constructing the controller with a |
Otherwise request mappings (methods) are not picked up: spring-projects/spring-framework#22154
Otherwise request mappings (methods) are not picked up: spring-projects/spring-framework#22154 This broke the tests in these modules, but we don't need to support this anymore: entity-module-no-adminweb entity-module-no-bootstrapui
Eugene Tenkaev opened SPR-17622 and commented
Following this approach here http://projects.spring.io/spring-cloud/spring-cloud.html#spring-cloud-feign-inheritance
If you add root
@RequestMapping
to theUserService
it will be registered as handler in Spring MVC application.Example project to reproduce here https://github.com/Hronom/test-shared-mapping-interface
Related discussions:
To handle this properly need to avoid registration of controller that has only
@RequestMapping
annotation.Proposed solution:
Register handler only if it has annotation
@Controller
or@RestController
.Affects: 5.1.3
Issue Links:
1 votes, 3 watchers
The text was updated successfully, but these errors were encountered: