You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Quickstart: Launch your first Java application in Azure Container Apps
14
15
15
-
This article explains how to deploy a Spring PetClinic sample application to run on Azure Container Apps. By the end of this tutorial you will get an application accessible online, and you can manage it through the Azure portal.
16
+
This article shows you how to deploy the Spring PetClinic sample application to run on Azure Container Apps. Rather than manually creating a Dockerfile and directly using a container registry, you can deploy your Java application directly from a Java Archive (JAR) file or a web application archive (WAR) file.
16
17
17
-
Rather than manually creating a Dockerfile and directly using a container registry, you can deploy your Java application directly from a Java Archive(JAR) file or a web application archive (WAR) file.
18
+
By the end of this tutorial you deploy a web application, which you can manage through the Azure portal.
19
+
20
+
The following image is a screenshot of how your application looks once deployed to Azure.
18
21
19
22
:::image type="content" source="media/java-deploy-war-file/azure-container-apps-petclinic-warfile.png" alt-text="Screenshot of petclinic app.":::
20
23
21
24
## Prerequisites
22
25
23
26
| Requirement | Instructions |
24
27
|--|--|
25
-
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).<br<br>You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. <br><br>Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml?tabs=current) for details. |
28
+
| Azure account | If you don't have one, [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).<br><br>You need the *Contributor* or *Owner* permission on the Azure subscription to proceed. <br><br>Refer to [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.yml?tabs=current) for details. |
26
29
| GitHub Account | Get one for [free](https://github.com/join). |
> If necessary, you can specify the JDK version in the [Java build environment variables](java-build-environment-variables.md).
57
+
::: zone pivot="jar"
58
+
55
59
56
-
First, change into the *spring-petclinic* folder.
60
+
Change into the *spring-petclinic* folder.
57
61
58
62
```bash
59
63
cd spring-petclinic
60
64
```
61
65
62
-
Then, clean the Maven build area, compile the project's code, and create a JAR file, all while skipping any tests.
66
+
Clean the Maven build area, compile the project's code, and create a JAR file, all while skipping any tests.
63
67
64
68
```bash
65
69
mvn clean package -DskipTests
66
70
```
67
71
68
72
After you execute the build command, a file named *petclinic.jar* is generated in the */target* folder.
69
73
70
-
### [WAR](#tab/war)
74
+
::: zone-end
75
+
76
+
::: zone pivot="war"
71
77
72
78
> [!NOTE]
73
79
> If necessary, you can specify the Tomcat version in the [Java build environment variables](java-build-environment-variables.md).
74
80
75
-
First, change into the *spring-framework-petclinic* folder.
81
+
Change into the *spring-framework-petclinic* folder.
76
82
77
83
```bash
78
84
cd spring-framework-petclinic
79
85
```
80
86
81
-
Then, clean the Maven build area, compile the project's code, and create a WAR file, all while skipping any tests.
87
+
Clean the Maven build area, compile the project's code, and create a WAR file, all while skipping any tests.
82
88
83
89
```bash
84
90
mvn clean package -DskipTests
85
91
```
86
92
87
93
After you execute the build command, a file named *petclinic.war* is generated in the */target* folder.
88
94
89
-
---
95
+
::: zone-end
90
96
91
97
## Deploy the project
92
98
93
-
### [JAR](#tab/jar)
99
+
::: zone pivot="jar"
100
+
94
101
Deploy the JAR package to Azure Container Apps.
95
102
103
+
> [!NOTE]
104
+
> If necessary, you can specify the JDK version in the [Java build environment variables](java-build-environment-variables.md).
105
+
96
106
Now you can deploy your WAR file with the `az containerapp up` CLI command.
97
107
98
108
```azurecli
99
109
az containerapp up \
100
-
--name <YOUR_CONTAINER_APP_NAME> \
101
-
--resource-group <YOUR_RESOURCE_GROUP> \
102
-
--subscription <YOUR_SUBSCRIPTION>\
110
+
--name <CONTAINER_APP_NAME> \
111
+
--resource-group <RESOURCE_GROUP> \
112
+
--subscription <SUBSCRIPTION_ID>\
103
113
--location <LOCATION> \
104
-
--environment <YOUR_ENVIRONMENT_NAME> \
105
-
--artifact <YOUR_JAR_FILE_PATH> \
114
+
--environment <ENVIRONMENT_NAME> \
115
+
--artifact <JAR_FILE_PATH_AND_NAME> \
106
116
--ingress external \
107
117
--target-port 8080 \
108
118
--query properties.configuration.ingress.fqdn
109
119
```
110
120
111
121
> [!NOTE]
112
-
> The default JDK version is 17. If you need to change the JDK version for compatibility with your application, you can use the `--build-env-var BP_JVM_VERSION=<YOUR_JDK_VERSION>` argument to adjust the version number.
122
+
> The default JDK version is 17. If you need to change the JDK version for compatibility with your application, you can use the `--build-env-vars BP_JVM_VERSION=<YOUR_JDK_VERSION>` argument to adjust the version number.
123
+
124
+
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md).
113
125
114
-
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md)
126
+
::: zone-end
127
+
128
+
::: zone pivot="war"
115
129
116
-
### [WAR](#tab/war)
117
130
Deploy the WAR package to Azure Container Apps.
118
131
119
132
Now you can deploy your WAR file with the `az containerapp up` CLI command.
120
133
121
134
```azurecli
122
135
az containerapp up \
123
-
--name <YOUR_CONTAINER_APP_NAME> \
124
-
--resource-group <YOUR_RESOURCE_GROUP> \
125
-
--subscription <YOUR_SUBSCRIPTION>\
136
+
--name <CONTAINER_APP_NAME> \
137
+
--resource-group <RESOURCE_GROUP> \
138
+
--subscription <SUBSCRIPTION>\
126
139
--location <LOCATION> \
127
-
--environment <YOUR_ENVIRONMENT_NAME> \
128
-
--artifact <YOUR_WAR_FILE_PATH> \
129
-
--build-env-var BP_TOMCAT_VERSION=10.* \
140
+
--environment <ENVIRONMENT_NAME> \
141
+
--artifact <WAR_FILE_PATH_AND_NAME> \
142
+
--build-env-vars BP_TOMCAT_VERSION=10.* \
130
143
--ingress external \
131
144
--target-port 8080 \
132
145
--query properties.configuration.ingress.fqdn
133
146
```
134
147
135
148
> [!NOTE]
136
-
> The default Tomcat version is 9. If you need to change the Tomcat version for compatibility with your application, you can use the `--build-env-var BP_TOMCAT_VERSION=<YOUR_TOMCAT_VERSION>` argument to adjust the version number.
149
+
> The default Tomcat version is 9. If you need to change the Tomcat version for compatibility with your application, you can use the `--build-env-vars BP_TOMCAT_VERSION=<YOUR_TOMCAT_VERSION>` argument to adjust the version number.
137
150
138
151
In this example, the Tomcat version is set to `10` (including any minor versions) by setting the `BP_TOMCAT_VERSION=10.*` environment variable.
139
152
140
-
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md)
153
+
You can find more applicable build environment variables in [Java build environment variables](java-build-environment-variables.md).
141
154
142
-
---
155
+
::: zone-end
143
156
144
-
## Verify the app status.
157
+
## Verify app status
145
158
146
159
In this example, `containerapp up` command includes the `--query properties.configuration.ingress.fqdn` argument, which returns the fully qualified domain name (FQDN), also known as the app's URL.
Copy file name to clipboardExpand all lines: articles/container-apps/java-overview.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,9 +24,9 @@ When you use Container Apps for your containerized Java applications, you get:
24
24
25
25
-**Build environment variables**: You can configure [custom key-value pairs](java-build-environment-variables.md) to control the Java image build from source code.
26
26
27
-
-**JAR deployment**: You can deploy your container app directly from a [JAR file](java-quickstart.md?tabs=jar).
27
+
-**JAR deployment**: You can deploy your container app directly from a [JAR file](java-get-started.md?tabs=jar).
28
28
29
-
-**WAR deployment**: You can deploy your container app directly from a [WAR file](java-quickstart.md?tabs=war).
29
+
-**WAR deployment**: You can deploy your container app directly from a [WAR file](java-get-started.md?tabs=war).
30
30
31
31
This article details the information you need to know as you build Java applications on Azure Container Apps.
32
32
@@ -119,4 +119,4 @@ Azure Container Apps offers support for the following Spring Components as manag
119
119
## Next steps
120
120
121
121
> [!div class="nextstepaction"]
122
-
> [Launch your first Java app](java-quickstart.md)
122
+
> [Launch your first Java app](java-get-started.md)
0 commit comments