Spring Tools 4 For Visual Studio Code


Visual Studio Code is an ideal lightweight development environment for Spring Boot application developers and there are several useful VS Code extensions including:

If you run into any issues when using the features below, you can contact us by clicking the Report an issue button below.


A working Java environment with essential extensions installed is needed, including:

Download Visual Studio Community, Professional, and Enterprise. Try Visual Studio IDE, Code or Mac for free today. While the Spring Tools 4 Public Beta (and the Spring Tools 4 in general) come as a totally new and independent distribution of Eclipse (called the Spring Tool Suite 4), extensions for Visual Studio Code and Atom, we also offer an early access extension pack for the now-released STS 3.9.4 distribution (via an Extension Install listing on the STS dashboard). The Spring Tools 4 can connect to running Spring processes to visualize internal information of those running Spring processes inline with your source code. This allows you to see, for example, which beans have bean created at runtime, how they are wired, and more.

  • Java Development Kit (JDK), version 11 or later.
  • Apache Maven, version 3.0 or later.

For more details, please refer to Java Tutorial

Note: More information about JDK can be found at supported Java versions.

The Spring Tools 4 can connect to running Spring processes to visualize internal information of those running Spring processes inline with your source code. This allows you to see, for example, which beans have bean created at runtime, how they are wired, and more.

Create the project

The Spring Initializr extension allows you to search for dependencies and generate new Spring Boot projects.

To install, launch VS Code and from the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)), search for vscode-spring-initializr.

Once you have the extension installed, open the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)) and type Spring Initializr to start generating a Maven or Gradle project and then follow the wizard.

Edit the project

The Spring Initializr extension allows you to edit dependencies after generating a new Spring Boot project.

Navigate to your pom.xml file and right-click to select Edit starters. The Command Palette will show the dependencies you already have beginning with a . You can search for other dependencies you want to add to your project. Or you can click on the existing dependencies to remove them.

Develop the application

The Spring Boot Tools extension includes rich language support for working with Spring Boot application.properties, application.yml, and .java files.

The extension supports quick navigate through source code, smart code completions, quick access to running apps, live application information, and code templates. Similar code completion and validation features are also available for .properties and .yml files.

Run the application

In addition to click F5 to run your application, there's another convenient extension Spring Boot Dashboard with which you can view and manage all available Spring Boot projects in your workspace as well as quickly start, stop, or debug your project.

Next steps

  • To deploy your web app, see the Deploy a Java Application to Azure tutorial.
  • To containerize a web app and deploy as a Docker container, check out the Working with Docker.
  • To learn more about Java Debugging features, see Java Debugging Tutorial.

This tutorial shows you how to create a Java web application with Visual Studio Code. You'll learn how to run, debug, and edit the Java web app locally and then on a fully managed Microservices platform built for Java workloads: Azure Spring Cloud.


We will deploy a simple Spring Boot Getting Started web app to Azure Spring Cloud.

Azure Spring Cloud makes it easy to deploy Spring Boot microservice applications to Azure without any code changes. The service manages the infrastructure of Spring Cloud applications so developers can focus on their code. Other benefits include:

  • Efficiently migrate existing Spring apps and manage cloud scaling and costs.
  • Modernize apps with Spring Cloud patterns to improve agility and speed of delivery.
  • Run Java at cloud scale and drive higher usage without complicated infrastructure.
  • Develop and deploy rapidly without containerization dependencies.
  • Monitor production workloads efficiently and effortlessly.

Before you begin

Before running and deploying this sample, you must have the Java SE Development Kit (JDK) version 11 or above and Apache Maven build tools on your local development environment. If you don't already have them, install these tools first.

Download and install the Java Extension Pack.

Note: The JAVA_HOME environment variable must be set to the install location of the JDK to complete this tutorial.

Download Apache Maven version 3 or greater:

Install Apache Maven for your local development environment:

Download and test the Spring Boot app

Spring tools 4 for visual studio code 2020

Clone the Spring Boot Getting Started sample project to your local machine. You can clone a Git repository with the Git: Clone command in the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)). Paste https://github.com/spring-guides/gs-spring-boot.git as the URL of the remote repository and then decide the parent directory under which to put the local repository. After that, open the complete folder within the cloned repository in VS Code by navigating to the folder and typing code ..

Note: You can install Visual Studio Code from https://code.visualstudio.com and Git from https://git-scm.com.

From within VS Code, open any of the Java files within the complete folder (for example srcmainjavahelloApplication.java). If you don't have the Java language extensions installed for VS Code, you will be prompted to install the Microsoft Java Extension Pack. Follow the instructions and reload VS Code after the installation.

Once you have the Java Extension Pack installed, it will automatically build the project for you (the build may take several minutes). You can run the application within VS Code by pressing F5 and selecting the Java environment. The Java Debug extension will generate a debugging configuration file launch.json for you under a .vscode folder in your project. You can see build progress in the VS Code Status bar and when everything is finished, the final active debug configuration is displayed.

You can learn more about how VS Code launches your application in Debugging Launch Configurations. Press F5 again to launch the debugger.

Test the web app by browsing to http://localhost:8080 using a web browser. You should see the following message displayed: 'Greetings from Spring Boot!'.

Make a change

Spring tools 4 for eclipse

Let's now edit HelloController.java to change 'Greetings from Spring Boot!' to something else like 'Hello World'. VS Code provides a great editing experience for Java, check out Editing and Navigating Code to learn about VS Code's editing and code navigation features.

Select the Restart button on the top of the editor to relaunch the app and see result by reloading the browser.

Debug the application

Set a breakpoint (F9) in the application source code, and reload your browser to hit the breakpoint.

If you would like to learn more about debugging Java with VS Code, you can read Java Debugging.

Congratulations, you have your first Spring Boot web app running locally! Read on to learn how to host it in the cloud.

Deploy to Azure Spring Cloud

We just built a Java web application and ran it locally. Now you will learn how to deploy from Visual Studio Code and run it on Azure Spring Cloud.

Install the Azure Spring Cloud extension

The Azure Spring Cloud extension is used to create, manage, and deploy to Azure Spring Cloud with key features including:

  • Create/View/Delete apps in Azure Spring Cloud
  • Deploy Jar to the app
  • Access the app with public/private endpoint
  • Start, stop, and restart the app
  • Scale the app in/out, up/down
  • Config application settings such as environment variables and JVM options
  • Stream logs from the app

To install the Azure Spring Cloud extension, open the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)) and search for azure spring cloud to filter the results. Select the Microsoft Azure Spring Cloud extension. For a command-line experience, you can also check out the Azure Spring Cloud quickstart with Azure CLI.

Spring Tools 4 For Visual Studio Codes

Spring tools 4 for visual studio code free

Sign in to your Azure subscription

The deploy process uses the Azure Account extension (installed along with the Spring Cloud extension as a dependency) and you need to sign in with your Azure subscription.

If you don't have an Azure subscription, you can sign up for a free Azure account.

To sign in to Azure, run Azure: Sign In from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)). You can then sign in to your account using the Device Login flow. Select Copy & Open to open your default browser.

Spring Tools 4 For Visual Studio Code 2020

Paste in the access code and continue the sign in process.

Create an app on Azure Spring Cloud

Once you are signed in to your Azure account and you have your app open in Visual Studio Code, select the Azure icon in the Activity Bar to open the Azure Explorer and you will see the Azure Spring Cloud panel.

  1. Right-click on your subscription and select Create Service in Portal. Finish the following steps on the Azure Portal to create an Azure Spring Cloud service instance.

  2. After the service instance is created, refresh the Azure Explorer to display the new service instance. Right-click on the service instance and select Create App. Type the app name, select the Java version, and then press Enter to start creating. The app will be ready in a few minutes.

Build and deploy the app

You can open the command prompt or terminal window and build the project using Maven commands. The build will generate a new war or jar artifact in the target directory.

  1. Right-click on the App in Azure Explorer, select Deploy, and pick your built Jar file when prompted.

  2. You can watch the deployment status on the bottom right. Once done, select Access Public Endpoint to test the app running on Azure and Yes when prompted to assign a public endpoint. Be aware that only Spring Boot fat Jar is supported, learn more about apps on Azure Spring Cloud.

Scale the app

Spring Tools 4 For Visual Studio Code Download

  1. You can easily scale the app by right-clicking on the Instance count under Scale Settings and selecting Edit. Type '2' and press Enter to scale the app.

Stream your application logs

  1. Expand the App Instances node, right-click the instance you want to see logs, and select Start Streaming Logs.

  2. The Visual Studio Code output window opens with a connection to the log stream.

Next steps

Spring Tools 4 For Visual Studio Code

  • Explore more powerful features of Azure Spring Cloud with Microservices.
  • To learn more about Java Debugging features, read the Java Debugging Tutorial.