Essential Spring Boot SnippetsThis extension is optimized for developers who wants to develop Spring Boot applications. These code snippets contains Java and EditorConfig snippets. This extension is still in progress. Let me know if you have any suggestion! Thanks! Features
Code SnippetsSpring Boot (
|
Prefix | Description |
---|---|
api-controller |
Generate RestController |
api-get |
Spring Boot Controller GET action |
api-get-all |
Spring Boot Controller GET action for all items |
api-get-by-id |
Spring Boot Controller GET action for one item |
api-get-query |
Spring Boot Controller GET action with RequestParam |
api-post |
Spring Boot Controller POST action |
api-put |
Spring Boot Controller PUT action |
api-delete |
Spring Boot Controller DELETE action |
api-dto |
Generate DTO class for an API action |
The
api-dto
snippet needlombok
andspring-boot-starter-validation
dependencies been installed in the project.
Spring Data JPA (java
)
Prefix | Description |
---|---|
jpa-repository |
Generate Spring Data JPA Repository class |
jpa-entity |
Generate Spring Data JPA Entity class |
Spring Boot Properties (spring-boot-properties
)
Prefix | Description |
---|---|
jpa-datasource |
Setup Spring Data JPA datasource |
Spring Boot Properties - YAML (spring-boot-properties-yaml
)
Prefix | Description |
---|---|
jpa-datasource |
Setup Spring Data JPA datasource |
Java (java
)
Prefix | Description |
---|---|
sout |
Print a string to System.out |
serr |
Prints a string to System.err |
private_field |
Private field |
public_field |
Public field |
st |
String |
thr |
throw new |
EditorConfig (editorconfig
)
Prefix | Description |
---|---|
java |
Generates .editorconfig for Java project |
VSCode User Settings (json
)
Prefix | Description |
---|---|
java |
Generates VSCode User Settings for Java projects |
rest-client |
Generates VSCode user settings for REST Client |
Apache Maven POM File (xml
)
Prefix | Description |
---|---|
pom-basic |
Generates POM Basic Structure |
pom-aggregator |
Generates POM Aggregator Structure |
pom-parent-snippet |
Generates POM <parent> snippet |
pom-profiles |
Generates POM <profiles> snippet |
pom-profile |
Generates POM <profile> snippet |
jboss-web |
Generates WildFly/JBoss Web Deployment Descriptor (src/main/webapp/WEB-INF/jboss-web.xml ) |
wildfly-web |
Generates WildFly/JBoss Web Deployment Descriptor (src/main/webapp/WEB-INF/jboss-web.xml ) |
Extensions
This extension bundled with some MUST needed VSCode extensions for Spring Boot developments.
-
- Language Support for Java™ by Red Hat
- Code Navigation
- Auto Completion
- Refactoring
- Code Snippets
- Debugger for Java
- Debugging
- Java Test Runner
- Run & Debug JUnit/TestNG Test Cases
- Maven for Java
- Project Scaffolding
- Custom Goals
- Project Manager for Java
- Manage Java projects, referenced libraries, resource files, packages, classes, and class members
- IntelliCode
- AI-assisted development
- Completion list ranked by AI
- Language Support for Java™ by Red Hat
-
Spring Initializr Java Support
Quickly generate a Spring Boot project in Visual Studio Code (VS Code). It helps you to customize your projects with configurations and manage Spring Boot dependencies.
-
With an explorer in the side bar, you can view and manage all available Spring Boot projects in your workspace. It also supports the features to quickly start, stop or debug a Spring Boot project.
-
Provides validation and content assist for Spring Boot
application.properties
,application.yml
properties files. As well as Boot-specific support for.java
files.
-
This extension allows you to decompile Java class files.
Lombok Annotations Support for VS Code
A lightweight extension to support Lombok annotations processing in Visual Studio Code
-
Dependency Analytics is powered by Snyk Intel Vulnerability DB, it is the most advanced and accurate open source vulnerability database in the industry. That adds value with the latest, fastest and more number of vulnerabilities derived from numerous sources.
-
Viewing
target/site
or JaCoCo report can use this extension very easily. -
XML Language Support by Red Hat.
-
YAML Language Support by Red Hat, with built-in Kubernetes syntax support.
Spring support two types of configuration:
application.properties
andapplication.yml
-
REST Client for Visual Studio Code. Really useful tool. You should definitely try it.
-
EditorConfig Support for Visual Studio Code
I also recommend the following extensions you MIGHT need.
Linting
-
Provide real-time feedback about Checkstyle violations and quick fix actions
-
SonarLint helps you detect and fix quality issues as you write code in Java.
-
Server Connectors
-
Connects vscode with open source community-driven servers and runtimes. Supported servers includes Apache Tomcat [ 5.5 | 6.0 | 7.0 | 8.0 | 8.5 | 9.0 ], Apache Karaf [ 4.8 ], Apache Felix [ 3.2 | 4.6 | 5.6 | 6.0 ], Jetty [ 9.x ], Glassfish [ 5.x ], Websphere Liberty [ 21.x ]
-
Java Tools
-
Add Gradle language support for Visual Studio Code
-
Run Gradle tasks in VS Code
-
Quarkus Tools for Visual Studio Code is a feature-packed extension tailored for Quarkus application development within Visual Studio Code. You can quickly get started by using the extension's project generation and project debugging feature. The extension also provides amazing language features (completion, hover, validation etc.) for your project's
application.properties
file.
-
Containers and Microservices
-
Build docker images and work with image registries.
-
It provides an explorer view to manage clusters and the nodes inside. It also provides advanced syntax support for editing Kubernetes manifest files.
-
Workbench
-
Show
TODO
,FIXME
, etc. comment tags in a tree view -
Syntax highlighting for log files
-
Material Design Icons for Visual Studio Code
-
Git Version Control
Recommended VSCode User Settings
settings.json
{ "java.debug.settings.hotCodeReplace": "auto", "java.saveActions.organizeImports": true, "editor.foldingImportsByDefault": true }
.vscode/launch.json
{ "configurations": [ { "type": "java", "request": "launch", "name": "Launch Spring Boot", "mainClass": "${workspaceFolder}/src/main/java/com/example/demo1/Demo1Application.java", "envFile": "${workspaceFolder}/.env" } ] }
Remember change
mainClass
to your class that contains main() method.
Contributing
If you need any Java / Spring Boot snippets, please feel free to send PRs to me or simply drop me a note! 😊
Enjoy!