beginner springboot

About

Visit Spring Initializr to generate your boilerplate source code

Spring Initializr UI


Make sure you have a suitable version of JDK installed e.g. 22


Details

Part 1:

  1. Fill in the project details:
    Project: Maven // we use Maven as our Build Tool
    Language: Java
    Spring Boot: Choose the latest stable version
    Group: com.example (you can choose any name)
    Artifact: my-spring-boot-app (you can choose any name)
    
  2. Choose the Java version you have installed.

  3. Leave other options as default.

  4. Click “Generate” to download the starter project as a zip file.


Note:

  • Notice the option “Jar vs War”. Spring Boot .jar file is an executable that will contain all the required > dependencies and an embedded web server (e.g. Tomcat), that makes it easy to package and deploy. Spring Boot .war file requires an existing web server to run, which may be useful if you have multiple web apps to run together.

  • Notice the section ‘Dependencies’ on the right, you may add required dependencies e.g. Spring Security in the future. The dependency modules provide various powerful, battle-tested boilerplate code for setting up a web application, security practices, dev tools, which is one of the key strengths of the Spring Ecosystem.

Spring Dependencies UI



Part 2:

  1. Unzip the downloaded zip file.

  2. You’ll find a basic Spring Boot project structure.

  3. Open the project in your favorite text editor or IDE (e.g., IntelliJ IDEA, Eclipse, Visual Studio Code).

  4. Verify that the source code contains DemoApplication.javam typically under /src/main/java/<your package>

  5. Run the project (you may need to setup additional configurations for your IDE)


Output

The project should successfully terminate with a log similar to:

com.example.demo.DemoApplication         : Started DemoApplication in 0.757 seconds

Congrats! You have successfully ran your first Spring Boot project. Of course it doesn’t do anything yet, but pat yourself on the back for taking the first step!


Resources