Using Spring Initializr to create a sample Java Spring Boot Application

Unless you are using a Spring Boot IDE plugin or Spring Tool Suite (STS), the best way to create a Spring Boot project sample easily, would be to use the online Spring Initializr.

Visit Spring Initilizr here : https://start.spring.io/

spring initializer - user interface

Configuring Spring Boot Project

Main Configuration Options

Project

Defines the build type of your project. Two options to choose from.

  1. Maven
  2. Gradle

I personally prefer Maven over Gradle because I’m much more comfortable working with Maven. If you’re a Gradle user, no issue at all, we can choose Gradle as the Project’s build type.

Language

We can use Spring Boot framework in three similar languages. Mostly used in Java to date and currently gaining traction in Kotlin as well.

  1. Java
  2. Kotlin
  3. Groovy

Spring Boot

Here we choose the Spring Boot version that we’re going to use. There will be minor differences with all the versions but mostly all are the same.

Project Metadata

Primarily comes with two main configurations; Group ID and Artifact ID. If we may closely have a look there’s an “options” button. It contains some extra configurations we can use to initialize the Spring project.

Spring initializr - project metadata

Project Metadata Extra Options:

  • Name – Name of the project folder
  • Description – Description of the project
  • Package Name
  • Packaging – Two types of packaging options provided for JAVA – Jar and War
  • Java – Java version. Currently has Java 8, 11 & 13 as options. It doesn’t matter actually because even after downloading the Spring Boot project, we can easily switch through Java versions.

Dependencies

We can select and add primary dependencies to our application using this option.

Spring initializr - dependencies
Spring initializr – adding dependencies

As we can see in above image. I have added 3 different dependencies to my Spring Boot project

  • Spring web
  • MySQL Driver
  • Spring Data JPA

We can search for more dependencies by typing in the text field or use the grid view to see all the available dependencies and choose from there. There are a massive number of dependencies and categories we can choose from.

create spring boot application
Generate , explore, share Spring Boot application

Explore option

We can use the “Explore” button or by pressing “ctrl + space”, to explore and see how folder and file structure would look like.

Spring Initilizr - Explore option
Spring Initilizr – Explore option

Generate Spring Boot project

Use the “Generate” button or press “ctrl + Enter” to generate and download our ready to run Spring Boot Application.

1 thought on “Using Spring Initializr to create a sample Java Spring Boot Application

  1. Pingback: Using CrudRepository in Spring Boot with MySQL for Data Manipulation

Leave a Reply

Your email address will not be published. Required fields are marked *