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

Remove support for @RequestMapping over a FeignClient interface #547

Closed
cbornet opened this issue Jun 6, 2016 · 10 comments
Closed

Remove support for @RequestMapping over a FeignClient interface #547

cbornet opened this issue Jun 6, 2016 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@cbornet
Copy link

cbornet commented Jun 6, 2016

It seems that Spring-MVC interprets it as a controller.
If you use an Hystrix fallback inheriting from the interface, then it even fails at startup saying that there are two controllers for the same mapping.

@cbornet
Copy link
Author

cbornet commented Jun 6, 2016

@dsyer
Copy link
Contributor

dsyer commented Jun 9, 2016

Clarification: ut's only a problem if you have both a @FeignClient and a @Controller with the same type-level annotation (e.g. if they share an interface). Since this makes very little sense for a real application, it's not super urgent to do anything on our side (and it would take a change in Spring Framework anyway) to support it. Documentation is definitely a good idea if anyone wants to propose a change.

@cbornet
Copy link
Author

cbornet commented Jun 9, 2016

Note : in a spring-boot app, it crashes if you have both a @FeignClient and a FeignHystrixCallback implementing the interface because Spring-MVC complains about ambiguous path mapping.

@dsyer
Copy link
Contributor

dsyer commented Jun 9, 2016

Right, yes. That's worth documenting as well: you can't use fallback= in @FeignClient if there is a @RequestMapping on the interface.

@cbornet
Copy link
Author

cbornet commented Jun 9, 2016

It also gets scanned by springfox and probably other tools. Lots of worries 😄 ...

@yuliangjin1985
Copy link

Yes, when I used swagger and there are two controller and feignclient but accidently they have the same RequestMapping, then there are IllegalStateException: Ambiguous mapping, and the project failed starting.

@OlgaMaciaszek OlgaMaciaszek transferred this issue from spring-cloud/spring-cloud-netflix May 24, 2021
@OlgaMaciaszek OlgaMaciaszek added the good first issue Good for newcomers label Jun 28, 2021
@jenimal
Copy link

jenimal commented Oct 1, 2021

Hi @OlgaMaciaszek give me something easy so I cam step through a pull and remerge "the right way"

@OlgaMaciaszek
Copy link
Collaborator

@jenimal you can work on this issue.

@OlgaMaciaszek
Copy link
Collaborator

Will be switching it from a documentation-only issue to an enhancement. We think using @RequestMapping over @FeignClient interfaces is a bad practice and are going to remove the support for creating Feign clients annotated with @RequestMapping on interface level.

@OlgaMaciaszek OlgaMaciaszek added enhancement New feature or request in progress and removed good first issue Good for newcomers documentation labels Oct 7, 2021
@OlgaMaciaszek OlgaMaciaszek added this to To do in Hoxton.x via automation Oct 7, 2021
@OlgaMaciaszek OlgaMaciaszek added this to To do in 2020.0.5 via automation Oct 7, 2021
@OlgaMaciaszek OlgaMaciaszek added this to To do in 2021.0.0-M3 via automation Oct 7, 2021
@OlgaMaciaszek OlgaMaciaszek changed the title Document that RequestMapping over a FeignClient interface should not be used Remove support for @RequestMapping over a FeignClient interface Oct 7, 2021
cbezmen added a commit to cbezmen/spring-cloud-openfeign that referenced this issue Oct 11, 2021
@cbezmen cbezmen mentioned this issue Oct 11, 2021
@ryanjbaxter ryanjbaxter removed this from To do in 2021.0.0-M3 Oct 20, 2021
@ryanjbaxter ryanjbaxter added this to To do in 2021.0.0-RC1 via automation Oct 20, 2021
@OlgaMaciaszek OlgaMaciaszek moved this from To do to Done in 2020.0.5 Oct 22, 2021
@OlgaMaciaszek OlgaMaciaszek moved this from To do to Done in 2021.0.0-RC1 Oct 22, 2021
@OlgaMaciaszek OlgaMaciaszek moved this from To do to Done in Hoxton.x Oct 22, 2021
@OlgaMaciaszek OlgaMaciaszek added this to the 2.2.10.RELEASE milestone Oct 22, 2021
@OlgaMaciaszek
Copy link
Collaborator

Done with d6783a6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
2020.0.5
  
Done
2021.0.0-RC1
  
Done
Development

No branches or pull requests

5 participants