notes on developing spring boot in vscode.

a summary of things to know while trying spring boot on vscode.

1. Install

install Spring Boot Extension Pack.

it actually installs three extensions at once

1.1 Spring Boot Tools

features for easy access to request mapping and bean information

features to navigate to a controller by entering a uri

1.2. Spring Initializr Java Support

ability to specify and download dependencies when creating a new project.

also used when modifying a dependecy.

1.3. Spring Boot Dashboard

shows the running or executable projects.

shows registered beans per project and uri mapping in the menu

location requires clicking Explorer tab > Spring Boot Dashboard.

Spring Boot Dashboard in vscode

2. Maven

To view Maven settings, expand Mavne in the Explorer tab.

Maven Viewer

it's at the bottom, so it's hard to see.

3. Test

To write JUnit5 tests, install the Test Runner for Java extension.

Test Runner for java

3.1. Generate Tests...

When adding a TestClass, position the cursor over the class to be tested,

creating test case for java class in vscode

after pressing the light bulb on the left side of the image, click Source Actions... > Generate Tests..., and then click

create a Junit test class by creating the package path of the class you want to test under the src/main/test directory.

as a shortcut, you can place the cursor as shown above and type Ctrl + . to get the same pop-up menu.

3.2. Test Output

when you check the output on the console, you can use System.out.println()

you should not look at the TERMINAL or TEST RESULTS screen, but at the DEBUG CONSOLE.

console output in vscode

regardless of whether you are in normal or debug mode, all output will be in the DEBUG CONSOLE.

and to the right of DEBUG CONSOLE, you need to select the console screen to output.

choose console result for each testcase

i had a hard time seeing this.