A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/azure/container-apps/java-get-started below:

Launch Your First Java Application in Azure Container Apps using a WAR or JAR File

Quickstart: Launch your first Java application in Azure Container Apps using a WAR or JAR file

This article shows you how to deploy the Spring PetClinic sample application to Azure Container Apps using a web application archive (WAR) file or a Java Archive (JAR) file.

There are several options available for deploying Java applications, including the following options:

By the end of this tutorial, you deploy a web application that you can manage through the Azure portal. The following screenshot shows the home page of the PetClinic application deployed to Azure Container Apps:

Prerequisites Build the project

Build the project by using the following steps:

  1. Navigate to the spring-petclinic folder by using the following command:

    cd azure-container-apps-java-samples/spring-petclinic/spring-petclinic/
    
  2. Initialize and update the Spring PetClinic Sample Application repo to the latest version by using the following command:

    git submodule update --init --recursive
    
  3. Use the following command to clean the Maven build area, compile the project's code, and create a JAR file, skipping all tests during these processes:

    mvn clean verify
    

You now have a /target/petclinic.jar file.

  1. Navigate to the spring-framework-petclinic folder by using the following command:

    cd spring-framework-petclinic
    
  2. Use the following command to clean the Maven build area, compile the project's code, and create a JAR file, skipping all tests during these processes:

    mvn clean verify
    

You now have a /target/petclinic.war file.

Deploy the project

Deploy the JAR package to Azure Container Apps by using the following command:

az containerapp up \
    --resource-group <resource-group> \
    --name <container-app-name> \
    --subscription <subscription-ID>\
    --location <location> \
    --environment <environment-name> \
    --artifact <JAR-file-path-and-name> \
    --ingress external \
    --target-port 8080 \
    --query properties.configuration.ingress.fqdn

Deploy the WAR file to Azure Container Apps by using the following command:

Note

The default Tomcat version is 9. To change the version for compatibility with your application, use the --build-env-vars BP_TOMCAT_VERSION=<your-Tomcat-version> argument. In this example, the Tomcat version is set to 10 - including any minor versions - by setting BP_TOMCAT_VERSION=10.*. For more information, see Build environment variables for Java in Azure Container Apps (preview).

az containerapp up \
    --resource-group <resource-group> \
    --name <container-app-name> \
    --subscription <subscription>\
    --location <location> \
    --environment <environment-name> \
    --artifact <WAR-file-path-and-name> \
    --build-env-vars BP_TOMCAT_VERSION=10.* \
    --ingress external \
    --target-port 8080 \
    --query properties.configuration.ingress.fqdn
Verify the app status

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.

View the application by pasting this URL into a browser.

Clean up resources

If you plan to continue working with more quickstarts and tutorials, you might want to leave these resources in place. When you no longer need the resources, you can remove them to avoid Azure charges, by using the following command:

az group delete --name <resource-group>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4