Skip to content

Commit c75153d

Browse files
authored
Merge pull request #105163 from MikeDodaro/deployAppGuide
Improvements to dependency requirements
2 parents d337a70 + febdd5d commit c75153d

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

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

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ ms.author: brendm
1212

1313
This quickstart shows how to prepare an existing Java Spring application for deployment to Azure Spring Cloud. If configured properly, Azure Spring Cloud provides robust services to monitor, scale, and update your Java Spring Cloud application.
1414

15+
Other examples explain how to deploy an application to Azure Spring Cloud when the POM file is configured.
16+
* [Launch App using the Azure portal](spring-cloud-quickstart-launch-app-portal.md)
17+
* [Launch App using the Azure CLI](spring-cloud-quickstart-launch-app-cli.md)
18+
19+
This article explains the required dependencies and how to add them to the POM file.
20+
1521
## Java Runtime version
1622

1723
Only Spring/Java applications can run in Azure Spring Cloud.
@@ -20,17 +26,19 @@ Azure Spring Cloud supports both Java 8 and Java 11. The hosting environment con
2026

2127
## Spring Boot and Spring Cloud versions
2228

23-
Azure Spring Cloud supports only Spring Boot apps. It supports both Spring Boot version 2.1 and version 2.2. The following table lists the supported Spring Boot and Spring Cloud combinations:
29+
To prepare an existing Spring Boot application for deployment to Azure Spring Cloud include the Spring Boot and Spring Cloud dependencies in the application POM file as shown in the following sections.
30+
31+
Azure Spring Cloud supports only Spring Boot apps either Spring Boot version 2.1 or version 2.2. The following table lists the supported Spring Boot and Spring Cloud combinations:
2432

2533
Spring Boot version | Spring Cloud version
2634
---|---
2735
2.1 | Greenwich.RELEASE
2836
2.2 | Hoxton.RELEASE
2937

30-
Verify that your pom.xml file has the correct Spring Boot and Spring Cloud dependencies based on your Spring Boot version.
31-
3238
### Dependencies for Spring Boot version 2.1
3339

40+
For Spring Boot version 2.1 add the following dependencies to the application POM file.
41+
3442
```xml
3543
<!-- Spring Boot dependencies -->
3644
<parent>
@@ -55,6 +63,8 @@ Verify that your pom.xml file has the correct Spring Boot and Spring Cloud depen
5563

5664
### Dependencies for Spring Boot version 2.2
5765

66+
For Spring Boot version 2.2 add the following dependencies to the application POM file.
67+
5868
```xml
5969
<!-- Spring Boot dependencies -->
6070
<parent>
@@ -79,7 +89,7 @@ Verify that your pom.xml file has the correct Spring Boot and Spring Cloud depen
7989

8090
## Azure Spring Cloud client dependency
8191

82-
Azure Spring Cloud hosts and manages Spring Cloud components for you. Such components include Spring Cloud Service Registry and Spring Cloud Config Server. Include the Azure Spring Cloud client library in your dependencies to allow communication with your Azure Spring Cloud service instance.
92+
Azure Spring Cloud hosts and manages Spring Cloud components. The components include Spring Cloud Service Registry and Spring Cloud Config Server. Include the Azure Spring Cloud client library in your dependencies to allow communication with your Azure Spring Cloud service instance.
8393

8494
The following table lists the correct Azure Spring Cloud versions for your app that uses Spring Boot and Spring Cloud.
8595

@@ -92,6 +102,8 @@ Include one of the following dependencies in your pom.xml file. Select the depen
92102

93103
### Dependency for Azure Spring Cloud version 2.1
94104

105+
For Spring Boot version 2.1 add the following dependency to the application POM file.
106+
95107
```xml
96108
<dependency>
97109
<groupId>com.microsoft.azure</groupId>
@@ -102,6 +114,8 @@ Include one of the following dependencies in your pom.xml file. Select the depen
102114

103115
### Dependency for Azure Spring Cloud version 2.2
104116

117+
For Spring Boot version 2.2 add the following dependency to the application POM file.
118+
105119
```xml
106120
<dependency>
107121
<groupId>com.microsoft.azure</groupId>
@@ -112,7 +126,33 @@ Include one of the following dependencies in your pom.xml file. Select the depen
112126

113127
## Other required dependencies
114128

115-
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+
```
116156

117157
### Service Registry dependency
118158

@@ -179,3 +219,10 @@ In this tutorial, you learned how to configure your Java Spring application for
179219
> [Learn how to set up a Config Server instance](spring-cloud-tutorial-config-server.md)
180220
181221
More samples are available on GitHub: [Azure Spring Cloud Samples](https://github.com/Azure-Samples/Azure-Spring-Cloud-Samples).
222+
223+
## See also
224+
* [Analyze application logs and metrics](https://docs.microsoft.com/azure/spring-cloud/diagnostic-services)
225+
* [Set up your Config Server](https://docs.microsoft.com/azure/spring-cloud/spring-cloud-tutorial-config-server)
226+
* [Use distributed tracing with Azure Spring Cloud](https://docs.microsoft.com/azure/spring-cloud/spring-cloud-tutorial-distributed-tracing)
227+
* [Spring Quickstart Guide](https://spring.io/quickstart)
228+
* [Spring Boot documentation](https://spring.io/projects/spring-boot)

0 commit comments

Comments
 (0)