Remove @EnableDiscoveryClient and @EnableEurekaClient (#2242)

* Remove @EnableDiscoveryClient and @EnableEurekaClient as there are now optional.  Fixes #2241.
This commit is contained in:
Ryan Baxter
2017-09-25 13:18:04 -04:00
committed by GitHub
parent c6fa162728
commit 145b7ce69a
13 changed files with 12 additions and 34 deletions

View File

@@ -38,7 +38,6 @@ Example eureka client:
@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient
@RestController
public class Application {
@@ -54,9 +53,8 @@ public class Application {
}
----
(i.e. utterly normal Spring Boot app). In this example we use
`@EnableEurekaClient` explicitly, but with only Eureka available you
could also use `@EnableDiscoveryClient`. Configuration is required to
(i.e. utterly normal Spring Boot app). By having `spring-cloud-starter-netflix-eureka-client`
on the classpath your application will automatically register with the Eureka Server. Configuration is required to
locate the Eureka server. Example:
@@ -76,7 +74,8 @@ The default application name (service ID), virtual host and non-secure
port, taken from the `Environment`, are `${spring.application.name}`,
`${spring.application.name}` and `${server.port}` respectively.
`@EnableEurekaClient` makes the app into both a Eureka "instance"
Having `spring-cloud-starter-netflix-eureka-client` on the classpath
makes the app into both a Eureka "instance"
(i.e. it registers itself) and a "client" (i.e. it can query the
registry to locate other services). The instance behaviour is driven
by `eureka.instance.*` configuration keys, but the defaults will be
@@ -86,6 +85,8 @@ ID, or VIP).
See {github-code}/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaInstanceConfigBean.java[EurekaInstanceConfigBean] and {github-code}/spring-cloud-netflix-eureka-client/src/main/java/org/springframework/cloud/netflix/eureka/EurekaClientConfigBean.java[EurekaClientConfigBean] for more details of the configurable options.
To disable the Eureka Discovery Client you can set `eureka.client.enabled` to `false`.
=== Authenticating with the Eureka Server
HTTP basic authentication will be automatically added to your eureka
@@ -240,7 +241,7 @@ random value will not be needed.
=== Using the EurekaClient
Once you have an app that is `@EnableDiscoveryClient` (or `@EnableEurekaClient`) you can use it to
Once you have an app that is a discovery client 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
`com.netflix.discovery.EurekaClient` (as opposed to the Spring
@@ -971,7 +972,6 @@ Example spring boot app
@Configuration
@ComponentScan
@EnableAutoConfiguration
@EnableEurekaClient
@EnableFeignClients
public class Application {