Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
3ef58cdc
Commit
3ef58cdc
authored
Sep 30, 2015
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change DiscoveryClient->EurekaClient in docs
parent
17dc4f6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
spring-cloud-netflix.adoc
docs/src/main/asciidoc/spring-cloud-netflix.adoc
+7
-7
No files found.
docs/src/main/asciidoc/spring-cloud-netflix.adoc
View file @
3ef58cdc
...
@@ -193,17 +193,17 @@ unique. In Cloudfoundry the `spring.application.instance_id` will be
...
@@ -193,17 +193,17 @@ unique. In Cloudfoundry the `spring.application.instance_id` will be
populated automatically in a Spring Boot Actuator application, so the
populated automatically in a Spring Boot Actuator application, so the
random value will not be needed.
random value will not be needed.
=== Using the
Discovery
Client
=== Using the
Eureka
Client
Once you have an app that is `@Enable
EurekaClient`
you can use it to
Once you have an app that is `@Enable
DiscoveryClient` (or `@EnableEurekaClient`)
you can use it to
discover service instances from the <<spring-cloud-eureka-server,
discover service instances from the <<spring-cloud-eureka-server,
Eureka Server>>. One way to do that is to use the native
Eureka Server>>. One way to do that is to use the native
`com.netflix.discovery.
Discovery
Client` (as opposed to the Spring
`com.netflix.discovery.
Eureka
Client` (as opposed to the Spring
Cloud `DiscoveryClient`), e.g.
Cloud `DiscoveryClient`), e.g.
----
----
@Autowired
@Autowired
private
Discovery
Client discoveryClient;
private
Eureka
Client discoveryClient;
public String serviceUrl() {
public String serviceUrl() {
InstanceInfo instance = discoveryClient.getNextServerFromEureka("STORES", false);
InstanceInfo instance = discoveryClient.getNextServerFromEureka("STORES", false);
...
@@ -213,16 +213,16 @@ public String serviceUrl() {
...
@@ -213,16 +213,16 @@ public String serviceUrl() {
[TIP]
[TIP]
====
====
Don't use the `
Discovery
Client` in `@PostConstruct` method or in a
Don't use the `
Eureka
Client` in `@PostConstruct` method or in a
`@Scheduled` method (or anywhere where the `ApplicationContext` might
`@Scheduled` method (or anywhere where the `ApplicationContext` might
not be started yet). It is initialized in a `SmartLifecycle` (with
not be started yet). It is initialized in a `SmartLifecycle` (with
`phase=0`) so the earliest you can rely on it being available is in
`phase=0`) so the earliest you can rely on it being available is in
another `SmartLifecycle` with higher phase.
another `SmartLifecycle` with higher phase.
====
====
=== Alternatives to the native Netflix
Discovery
Client
=== Alternatives to the native Netflix
Eureka
Client
You don't have to use the raw Netflix `
Discovery
Client` and usually it
You don't have to use the raw Netflix `
Eureka
Client` and usually it
is more convenient to use it behind a wrapper of some sort. Spring
is more convenient to use it behind a wrapper of some sort. Spring
Cloud has support for <<spring-cloud-feign, Feign>> (a REST client
Cloud has support for <<spring-cloud-feign, Feign>> (a REST client
builder) and also <<spring-cloud-ribbon, Spring `RestTemplate`>> using
builder) and also <<spring-cloud-ribbon, Spring `RestTemplate`>> using
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment