Install Visual Studio Code 1.44.0 or higher; Launch Code; From the command palette Ctrl-Shift-P (Windows, Linux) or Cmd-Shift-P (OSX) Select Install Extension; Choose the extension; Reload Visual Studio Code.
The code generated by lombok will not ignore, wrap, replace, or otherwise modify the thrown checked exception; it simply fakes out the compiler. On the JVM (class file) level, all exceptions, checked or not, can be thrown regardless of the throws clause of your methods, which is why this works. In this quick video, Kris shows you how to get started with Spring Boot in Visual Studio Code. He quickly shows you which extensions to install, how to creat. To set up lombok with any build tool, you have to specify that the lombok dependency is required to compile your source code, but does not need to be present when running/testing/jarring/otherwise deploying your code. Generally this is called a 'provided' dependency. This page explains how to integrate lombok with the Apache Maven build tool. Lombok is available in maven central, so telling Maven to download lombok.
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.
Prerequisites
A working Java environment with essential extensions installed is needed, including:
- 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.
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
.
Visual Studio Code Java Lombok
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.
Lombok Java Visual Studio Code
Next steps
Visual Studio Code Lombok Not Working
- 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.