Skip to content

Latest commit

 

History

History
109 lines (77 loc) · 2.67 KB

File metadata and controls

109 lines (77 loc) · 2.67 KB

Deploy a Hello World Spring Boot application

spring/helloworld/README.md

Prerequisites

This example assumes you have previously completed the following examples:

  1. Create an Azure Resource Group
  2. Deploy an Azure Spring Apps environment

Build the example

To build the JAR file use the following Maven command line.

  mvn package

Run example locally

To run the example locally use the following Maven command line.

  mvn spring-boot:run

Deploy the Hello World Spring Boot application to Azure Spring Cloud

  az spring app create \
    --name helloworld \
    --service ${SPRING_NAME} \
    --resource-group ${RESOURCE_GROUP} \
    --assign-endpoint \
    --runtime-version Java_11 \
    --verbose

  az spring app deploy \
    --name helloworld \
    --service ${SPRING_NAME} \
    --resource-group ${RESOURCE_GROUP} \
    --artifact-path ./target/spring-helloworld.jar \
    --verbose

  az spring app show \
    --name helloworld \
    --service ${SPRING_NAME} \
    --resource-group ${RESOURCE_GROUP} \
    --query properties.url \
    --output tsv

You can verify the application works, now on Azure Spring Apps, by using your browser and going to the URL shown.

It should show you the following:

Hello World

Cleanup

Do NOT forget to remove the resources once you are done running the example.

Reference documentation

  1. Commands to manage Azure Spring Apps
  2. Azure Spring Cloud Documentation
  3. Quickstart: Build and deploy apps to Azure Spring Cloud

6m