Spring Initializr: The Spring Boot Project Generator
The Spring Initializr is a spring boot project generator. It is a web-based tool provided by the Pivotal Web Service. It allows us to generate the Spring boot project structure. Further, it facilitates with the extensible API for developing JVM-based projects.
The Spring Initializr provides several options for the project that are expressed in a metadata model. The metadata model is used for configuring the required dependencies.
The Spring Starter supports both the build tool Gradle and Maven.
Spring Initializr Interface
The Spring Initializr provides a user-friendly interface. It provides various versions of programming language (Java, Kotlin, Groovy), SpringBoot, and build tools (maven and Gradle).
It let us choose different versions of the following:
Build tools
It allows us to choose the build tool such as:
- Maven
- Gradle
Language
It allows us to choose the programming language such as:
- Java
- Kotlin
- Groovy
Spring Boot Versions
It allows us to choose the spring Boot Versions such as:
- 2.4.0 (SNAPSHOT)
- 2.4.0 (M1)
- 2.3.2 (SNAPSHOT)
- 2.3.1
- 2.2.9 (SNAPSHOT)
- 2.2.8
- 2.1.16 (SNAPSHOT)
- 2.1.15
Project Metadata
It allows us to describe the project’s metadata such as:
- Group
- Artifact
- Name
- Description
- Package name
Packaging
It provides the following packaging options:
- jar
- war
Java version
It provides freedom to choose the Java versions such as:
- Java 14
- Java 11
- Java 8
The interface of Spring Initializr looks like:
Supported Tools
- The Spring Initilaizr projects can be imported in IDE STS, IntelliJ IDEA Ultimate, NetBeans, Eclipse. Or we can download the supported plugin for these IDEs.
- We can download the NetBeans IDE plugin from Here. For VSCode, download the plugin from here.
- For Custom Web UI Click Here.
- It also supports the command-line with the Spring Boot CLI or cURL or HTTPie.
Spring Initializr Modules
Spring Initializr has the following module:
initializr-actuator (optional): The actuator provides additional information and statistics on project generation.
initializr-bom: The BOM stands for Bill Of Materials. It is a special type of POM that controls the versions of project dependencies. It provides a position at central to define and update dependencies versions. It is a flexible module that adds dependencies in the module without worrying about the versions. The BOM is a collection of parts, items, assemblies, and other materials that are required to create a project. It defines the necessary required material and their positions.
initializr-docs: It provides documentation for the project.
initializr-generator: The initiliazr-generator contains a core project generation library.
initializr-generator-test: The initializr-generator-test provides a test infrastructure for project generation.
initializr-metadata: The initializr-metadata provides metadata infrastructure for various aspects of the projects.
initializr-service-example: The initializr-service-example provides custom instances.
initializr-version-resolver: The initializr-version-resolver is an optional module to extract version numbers from an arbitrary POM.
initializr-web: The initializr-web provides web endpoints for third party clients.
Getting Started With Spring Initializr
To auto-generate a spring boot project with Spring Initializr visit https://start.spring.io/.
Follow the below steps to generate a project:
Step1: Select the build tool:
select the Maven or Gradle build tool by clicking on it.
Step2: Select Language
Select the programming language from the below list:
Step3: Select Spring Boot version:
Select the SB version from the below list:
Step4: Provide the Project metadata:
Provide the project metadata such as Group, Artifact, etc.
Step5: Select the required dependencies:
Select the required dependencies for the spring boot project. Later we will discuss these dependencies in Spring boot dependencies sections:
Click on the add dependencies list:
It will open a search window and list of dependencies.
Step6: Add the necessary dependencies:
Add the dependencies by selecting from the below list:
Step7: Generate the Project:
Generate the project by clicking on the generate option given at bottom:
Here, your spring boot project structure is ready. Import it in your favorite IDE and start developing the spring boot applications.