-
Notifications
You must be signed in to change notification settings - Fork 799
Support Multiple Clients Using The Same Service #90
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
Support Multiple Clients Using The Same Service #90
Conversation
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
===========================================
- Coverage 76.8% 76.7% -0.11%
- Complexity 298 302 +4
===========================================
Files 37 37
Lines 1246 1262 +16
Branches 185 187 +2
===========================================
+ Hits 957 968 +11
- Misses 211 216 +5
Partials 78 78
|
Codecov Report
@@ Coverage Diff @@
## master #90 +/- ##
============================================
- Coverage 76.8% 76.77% -0.04%
- Complexity 298 301 +3
============================================
Files 37 37
Lines 1246 1257 +11
Branches 185 187 +2
============================================
+ Hits 957 965 +8
- Misses 211 213 +2
- Partials 78 79 +1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this relate to #67?
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
import feign.*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We dont use * imports. Also the import order is wrong
I described what has been done on the issue page |
DuplicatedFeignClientNamesConfiguration.BarClient.class}) | ||
protected static class DuplicatedFeignClientNamesConfiguration { | ||
|
||
@FeignClient(name = "bar", serviceId = "bar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a lot of questions, but this example configuration doesnt make any sense to me, how are these different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a typo, fixed it. I wanted to test if it is possible to create two feign clients with the same serviceId, since it was previously used as a name taking precedence over name/value attribute (FeignClientsRegistrar.java#219 before changes). Actually, I was expecting this to fail, but it seems that by default allow bean overriding is set to true.
I dont think we can change the use of the @spencergibb thoughts? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This should be documented as another way to have multiple feign clients for the same service or url. The building feign clients by hand should remain in the docs.
@@ -73,6 +73,8 @@ in your external configuration (see | |||
|
|||
A central concept in Spring Cloud's Feign support is that of the named client. Each feign client is part of an ensemble of components that work together to contact a remote server on demand, and the ensemble has a name that you give it as an application developer using the `@FeignClient` annotation. Spring Cloud creates a new ensemble as an | |||
`ApplicationContext` on demand for each named client using `FeignClientsConfiguration`. This contains (amongst other things) an `feign.Decoder`, a `feign.Encoder`, and a `feign.Contract`. | |||
It is possible to override the name of that ensemble by using the `contextId` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an example of what this enables would be useful
Fixes gh-67