Clarify impact of @ComponentScan on @RibbonClient
Fixes gh-281
This commit is contained in:
@@ -137,7 +137,9 @@ random value will not be needed.
|
||||
|
||||
Once you have an app that is `@EnableEurekaClient` you can use it to
|
||||
discover service instances from the <<spring-cloud-eureka-server,
|
||||
Eureka Server>>. One way to do that is to use the native `DiscoveryClient`, e.g.
|
||||
Eureka Server>>. One way to do that is to use the native
|
||||
`com.netflix.discovery.DiscoveryClient` (as opposed to the Spring
|
||||
Cloud `DiscoveryClient`), e.g.
|
||||
|
||||
----
|
||||
@Autowired
|
||||
@@ -560,6 +562,14 @@ In this case the client is composed from the components already in
|
||||
`RibbonClientConfiguration` together with any in `FooConfiguration`
|
||||
(where the latter generally will override the former).
|
||||
|
||||
WARNING: The `FooConfiguration` has to be `@Configuration` but take
|
||||
care that it is not in a `@ComponentScan` for the main application
|
||||
context, otherwise it will be shared by all the `@RibbonClients`. If
|
||||
you use `@ComponentScan` (or `@SpringBootApplication`) you need to
|
||||
take steps to avoid it being included (for instance put it in a
|
||||
separate, non-overlapping package, or specify the packages to scan
|
||||
explicitly in the `@ComponentScan`).
|
||||
|
||||
Spring Cloud Netflix provides the following beans by default for ribbon
|
||||
(`BeanType` beanName: `ClassName`):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user