Deploy Spring Boot applications using IntelliJ

Note

The Basic, Standard, and Enterprise plans will be deprecated starting from mid-March, 2025, with a 3 year retirement period. We recommend transitioning to Azure Container Apps. For more information, see the Azure Spring Apps retirement announcement.

The Standard consumption and dedicated plan will be deprecated starting September 30, 2024, with a complete shutdown after six months. We recommend transitioning to Azure Container Apps.

The IntelliJ plug-in for Azure Spring Apps supports application deployment from IntelliJ IDEA.

Before running this example, you can try the basic quickstart.

Prerequisites

Install the plug-in

You can add the Azure Toolkit for IntelliJ IDEA 3.51.0 from the IntelliJ Plugins UI.

  1. Start IntelliJ. If you have opened a project previously, close the project to show the welcome dialog. Select Configure from link lower right, and then select Plugins to open the plug-in configuration dialog, and select Install Plugins from disk.

    Screenshot of IntelliJ IDEA Welcome dialog box with Configure element highlighted.

  2. Search for Azure Toolkit for IntelliJ. Select Install.

    Screenshot of IntelliJ IDEA Plugins dialog box with Install button highlighted.

  3. Select Restart IDE.

Tutorial procedures

The following procedures deploy a Hello World application using IntelliJ IDEA.

  • Open the gs-spring-boot project
  • Deploy to Azure Spring Apps
  • Show streaming logs

Open gs-spring-boot project

  1. Download and unzip the source repository for this tutorial, or clone it using the following Git command: git clone https://github.com/spring-guides/gs-spring-boot.git

  2. Navigate to the gs-spring-boot\complete folder.

  3. Open IntelliJ Welcome dialog, select Import Project to open the import wizard.

  4. Select the gs-spring-boot\complete folder.

    Screenshot of IntelliJ IDEA Open File or Project dialog box with complete folder highlighted.

Deploy to Azure Spring Apps

In order to deploy to Azure you must sign-in with your Azure account, and choose your subscription. For sign-in details, see Install and sign-in.

  1. Right-click your project in IntelliJ project explorer, and select Azure -> Deploy to Azure Spring Apps.

    Screenshot of IntelliJ IDEA context menu with Deploy to Azure Spring Apps option highlighted.

  2. Accept the name for app in the Name field. Name refers to the configuration, not app name. Users don't usually need to change it.

  3. Accept the identifier from the project for the Artifact.

  4. Select App: then click + to create an Azure Spring Apps instance.

    Screenshot of IntelliJ IDEA Deploy Azure Spring app dialog box with plus button highlighted.

  5. Enter App name, then select OK.

    Screenshot of IntelliJ IDEA Create Azure Spring App dialog box with App name field in focus.

  6. Start the deployment by selecting the Run button.

    Screenshot of IntelliJ IDEA showing Run button.

  7. The plug-in will run the command mvn package on the project and then create the new app and deploy the jar generated by the package command.

  8. If the app URL is not shown in the output window, get it from the Azure portal. Navigate from your resource group to the instance of Azure Spring Apps. Then select Apps. The running app will be listed. Select the app, then copy the URL or Test Endpoint.

    Screenshot of Azure portal showing the app overview page with the URL and Test Endpoint fields highlighted.

  9. Navigate to the URL or Test Endpoint in the browser.

    Screenshot of the app running in a browser displaying the message Greetings from Spring Boot.

Show streaming logs

To get the logs:

  1. Select Azure Explorer, then Spring Apps.

  2. Right-click the running app.

  3. Select Streaming Log from the drop-down list.

    Screenshot of IntelliJ IDEA context menu with the Streaming Log option highlighted.

  4. Select instance.

    Screenshot of the IntelliJ IDEA  Select Instance dialog box.

  5. The streaming log will be visible in the output window.

    Screenshot of the IntelliJ IDEA showing the streaming log in the output window.

Next steps