Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Essential Java Spring Boot SnippetsNew to Visual Studio Code? Get it now.

Essential Java Spring Boot Snippets

Preview

Will 保哥

|
3,691 installs
| (5) | Free
High quality Code Snippets that boost your Java Spring Boot development productivity.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Essential Spring Boot Snippets

This extension is optimized for developers who wants to develop Java 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

  • Provide Java, Controller, EditorConfig, JPA and VSCode User Settings snippets
  • Provide DTO snippets with Lombok & spring-boot-starter-validation dependency
  • Bundled with some must needed VSCode extensions

Code Snippets

Spring Boot (java)

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 need lombok and spring-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 Java Spring Boot developments.

  • Extension Pack for Java

    • 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
  • Spring Boot Extension Pack

    • 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.

    • Spring Boot Dashboard

      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.

    • Spring Boot Tools

      Provides validation and content assist for Spring Boot application.properties, application.yml properties files. As well as Boot-specific support for .java files.

  • Java Decompiler

    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

    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.

  • Live Preview

    Viewing target/site or JaCoCo report can use this extension very easily.

  • XML

    XML Language Support by Red Hat.

  • YAML

    YAML Language Support by Red Hat, with built-in Kubernetes syntax support.

    Spring support two types of configuration: application.properties and application.yml

  • REST Client

    REST Client for Visual Studio Code. Really useful tool. You should definitely try it.

  • EditorConfig for VS Code

    EditorConfig Support for Visual Studio Code

I also recommend the following extensions you MIGHT need.

  • Linting

    • Checkstyle for Java

      Provide real-time feedback about Checkstyle violations and quick fix actions

    • SonarLint

      SonarLint helps you detect and fix quality issues as you write code in Java.

  • Server Connectors

    • Community 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

    • Gradle Language Support

      Add Gradle language support for Visual Studio Code

    • Gradle Tasks

      Run Gradle tasks in VS Code

    • Quarkus

      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

    • Docker

      Build docker images and work with image registries.

    • Kubernetes

      It provides an explorer view to manage clusters and the nodes inside. It also provides advanced syntax support for editing Kubernetes manifest files.

  • Workbench

    • Todo Tree

      Show TODO, FIXME, etc. comment tags in a tree view

    • Output Colorizer

      Syntax highlighting for log files

    • Material Icon Theme

      Material Design Icons for Visual Studio Code

  • Git Version Control

    • Git Extension Pack

      Popular Visual Studio Code extensions for Git version control including GitLens, gitignore and Git Graph.

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!

  • Contact us
  • Jobs
  • Privacy
  • Terms of use
  • Trademarks
© 2023 Microsoft