Spring Initializr

Spring Boot applications can be kickstarted in multiple ways. One of the ways is to use the Eclipse-based Spring Tools Suite IDE (https://spring.io/tools/sts). Another way is to use https://start.spring.io, also known as Spring Initializr. First things first, Spring Initializr is not Spring Boot or an equivalent. Spring Initializr is a tool that has simple web UI support to configure the Spring Boot application. It can be considered a tool for a quick-start generation of Spring projects. It provides APIs that can be extended for customization in order to generate the projects.

The Spring Initializr tool provides a configuration structure to define a list of dependencies, supported Java and Spring Boot versions, and supported dependency versioning.

Basically, Spring Initializr creates an initial Spring project based on the configuration provided and allows the developer to download the project in a ZIP file. Here are the steps to be followed:

  1. Navigate to https://start.spring.io/.
  2. Choose the dependency management tool from Maven or Gradle.
  3. Choose the JVM-based programming language from Java, Kotlin, and Groovy.
  4. Choose the Spring Boot version to be used.
  5. Provide the Group artifact by inputting the group name as com.packt.springhighperformance.
  1. Input Artifact, which is the artifact ID for the Maven project. This will become the name of the project WAR or JAR file to be deployed or executed.
  2. Choose a packaging type from Jar and War.
  3. Click on the Switch to the full version link. This will open up a list of starter projects to choose from. The starter project will be explained in detail in the following section.
  4. Once we have chosen the starters or dependencies, click on the Generate Project button. This will download the ZIP file containing the initial project configuration.

The following is the Spring Initializr screen with a few configurations:

Once done, a folder structure similar to what is shown in the following screenshot will be generated:

Spring Initializr also supports the command-line interface to create the Spring project configuration. The following command can be used to generate a project configuration:

> curl https://start.spring.io/starter.zip -d dependencies=web,jpa -d bootVersion=2.0.0 -o ch-09-spring-boot-example-1.zip

As mentioned earlier, Spring Initializr supports integration with IDE. It integrates well with Eclipse/STS, IntelliJ ultimate edition, and NetBeans with NB the SpringBoot plugin.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset