Skip to content

Commit e37f3c3

Browse files
committed
Add EnableDiscoveryClient annotation
1 parent f16ccec commit e37f3c3

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

articles/spring-cloud/spring-cloud-tutorial-prepare-app-deployment.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Include one of the following dependencies in your pom.xml file. Select the depen
102102

103103
### Dependency for Azure Spring Cloud version 2.1
104104

105-
For Spring Boot version 2.1 add the following dependencies to the application POM file.
105+
For Spring Boot version 2.1 add the following dependency to the application POM file.
106106

107107
```xml
108108
<dependency>
@@ -114,7 +114,7 @@ For Spring Boot version 2.1 add the following dependencies to the application PO
114114

115115
### Dependency for Azure Spring Cloud version 2.2
116116

117-
For Spring Boot version 2.2 add the following dependencies to the application POM file.
117+
For Spring Boot version 2.2 add the following dependency to the application POM file.
118118

119119
```xml
120120
<dependency>
@@ -126,7 +126,33 @@ For Spring Boot version 2.2 add the following dependencies to the application PO
126126

127127
## Other required dependencies
128128

129-
To enable the built-in features of Azure Spring Cloud, your application must include the following dependencies. This inclusion ensures that your application configures itself correctly with each component.
129+
To enable the built-in features of Azure Spring Cloud, your application must include the following dependencies. This inclusion ensures that your application configures itself correctly with each component.
130+
131+
### EnableDiscoveryClient annotation
132+
133+
Add the following annotation to the application source code.
134+
```java
135+
@EnableDiscoveryClient
136+
```
137+
For example, see the piggymetrics application from earlier examples:
138+
```java
139+
package com.piggymetrics.gateway;
140+
141+
import org.springframework.boot.SpringApplication;
142+
import org.springframework.boot.autoconfigure.SpringBootApplication;
143+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
144+
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
145+
146+
@SpringBootApplication
147+
@EnableDiscoveryClient
148+
@EnableZuulProxy
149+
150+
public class GatewayApplication {
151+
public static void main(String[] args) {
152+
SpringApplication.run(GatewayApplication.class, args);
153+
}
154+
}
155+
```
130156

131157
### Service Registry dependency
132158

0 commit comments

Comments
 (0)