How setup Spring Boot application using Spring Initializr in 5 min?

In this artilce we are creating our first Spring Boot application using Spring Initializr.

Technology Used:

Java 8
Maven 3
Spring Boot 2.3.2

Step 1: Create New Project

We are using for creating new Spring Boot application. Spring Initializr provides defualt configuration for a quick start of the application. In our case we are using Maven 3, Java 8, Spring Boot 2.3.2.  Maven is one of the most popular build automation tool. In our case GroupId is com.codesakha and ArtifactId is SpringBootExample. GroupId presents package name and ArtifactId represents project name.

Step 2: pom.xml

After click on GENERATE button three main files created pom.xml,, pom.xml file contains dependencies, plugins, version of Java, artifactid, groupid and many more. If you concentrate on pom.xml then you get embedded tomcat also, this is one of the advantage of Spring Boot.

<project xmlns="" xmlns:xsi=""
		<relativePath/> <!-- lookup parent from repository -->
	<description>Hello World in Spring Boot</description>





Step 3: void main()

We don’t need to disuss anything about main function here. SpringApplication provides a way that start Spring application from main() method. is a static method as you can see.

package com.codesakha.SpringBootExample;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class SpringBootExampleApplication {

	public static void main(String[] args) {, args);


Step 4: SpringApplicationBuilder

It enables auto-configuration and component scanning.

package com.codesakha.SpringBootExample;

import org.springframework.boot.builder.SpringApplicationBuilder;

public class ServletInitializer extends SpringBootServletInitializer {

	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(SpringBootExampleApplication.class);


Step 5: mvn spring-boot:run

Now time came when we can install our project using mvn clean install. It will download all dependencies related to project. We can import this project in eclipse using mvn eclipse:eclipse. The last steps is come when we can run our project using mvn spring-boot:run. After run project console looks like this.

Please feel free to write any suggestion related to this article.

Leave a Reply

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