How to Create Spring Boot Project With Spring initializer

Hello Friends,

If you have used Spring framework previously, you must be aware that it takes some genuine effort to even get started with basic Spring functionality.With Spring Boot, that initial hassle is gone and you can get started in minutes.

Welcome to the world of Spring Boot!!!

In this tutorial, we will see various ways in which we can create a Spring Boot Project.

Basically, there are following four ways in which we can create Spring Boot Project :

1. Using initializer 
2. Using Eclipse or any similar IDE and Maven simple project
3. Using Spring Tool Suite
4. Using CLI

This tutorial will focus on creating Spring Boot project using initializer.

1. Spring Boot Project using initializer

Steps :

Step 1:

Open URL:

As we can see in above screenshot(you can refer extracted part below) screenshot that by default, it says that Generate a <Maven Project> With <Java> and Spring Boot <1.5.0>

But there are options to Generate a <Gradle Project> with <Kotlin>/<Groovy> and Sprig Boot<Lower versions> as well as per our requirements.

In this tutorial, we will focus on Maven with Java and Spring Boot 1.5.10.

Step 2:

As we are creating a Maven project and we know that every Maven project has group and artifact id, so this interface provides us with placeholders where we can enter group and artifact id.

We will enter the following as group and artifact id :

group       : nl.blogspot.javasolutionsguide.springboot
artifact Id : springBootApp

  Step 3:

  Click on the "switch to the full version" hyperlink, which is just below Generate Project button.

 Step 4:

You will notice following additional fields :

Description: This is simply the description of the project.You can change it as suitable but it does not make difference from the technical front.

Package Name: This is a name of the package that will be created by Spring by default when Spring boot project will be created using this GUI of

Packaging: This represents how the project will be bundled as a deliverable.Here we have two options :

Jar   - Java Archive
War - Web Archive

We are going with Jar option.

Java Version :

As of writing this tutorial, we have three options 7,8 and 9.I will go with the default which is Java 8.

Step 5:

Scroll down on the web page and you will find below a list of dependencies which you can add in your application depending upon the requirements.Here we will add only Web dependency.For that, you just need to tick that dependency and once you will click on Generate Project, this dependency will be added to the generated project.

Step 6:

Click on Generate Project and you will see that project will be downloaded and Zip on your hard drive with the name which you would have given in Artifact text box.

Step 7:

Extract project using WinZip and import in Eclipse as Maven Project by right clicking in Package Explorer and then select import... -> Existing Maven project ->Next -> Chose extracted project from the hard drive -> Click Finish.

Step 8:

You will see a java project as per Maven standard is there in eclipse.And with this, you have already set up a Spring Boot project in Eclipse.Easy.... right.

Step 9:

Let's explore the project that has been created.

- Open Pom.xml and you will find that Pom is created with the following project co-ordinates as we       defined in GUI




 <description>Demo project for Spring Boot</description>

- Following parent has also been added automagically(note the word, it is Spring Boot's magic :)).

   <relativePath/> <!-- lookup parent from repository -->


It will make sure that following Maven dependencies are added to the project.You can try removing spring-boot-starter-parent from pom.xml and save the project and you will notice that all your following dependencies will be gone.

- In above list of dependencies, you must have noticed that spring boot has also added dependencies for embedded Tomcat so that you need not to install or configure tomcat in your eclipse explicitly.

- Also, you will find following properties, dependencies and plugin added automagically.Remember that as we selected Web in GUI,dependency spring-boot-starter-web has been added in POM file.






- If you open src/main/java, you will see that package which we mentioned in GUI has been created, which is "nl.blogspot.javasolutionsguide.springboot.springBootApp"

- Within the above-mentioned package, you will find a class SpringBootAppApplication.So basically a class with the name as  <Name of your Project> with "Application" word appended to it is created in the specified package.

public class SpringBootAppApplication {

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


- The @SpringBootApplication annotation used at the class level above is basically equivalent to combined following three annotations :


We will discuss more on these annotations in subsequent tutorials.

- From the main method of SpringBootAppApplication ,SpringApplicaiton class's run method is called.This method makes sure that Spring application's applicationContext(the Spring Container) is initialized.Spring boot uses AnnotaionConfigApplicationContext.

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


Step 10:

Run the main method of SpringBootAppApplication and you will notice that jar is automatically deployed to embedded Tomcat server and Tomcat server has been started at port 8080.

Check Console log of eclipse:

Step 11:

Now as our code is deployed on Tomcat and Tomcat is up and running, Let us try to hit 8080.

oh...Error Page and it says that "This application has no explicit mapping for /error, so you are seeing this as a fallback."

Step 12:

Let us go ahead and add mapping for /error by creating ErrorHandlerController under new package

public class ErrorHandlerController implements ErrorController{
private static final String PATH = "/error";
public String error() {
return "Error Handling";

public String getErrorPath() {
return PATH;


Please note that this controller needs to implement ErrorController interface which is provided by Spring Boot and we need to implement it's getErrorPath() method.

Also as I told earlier @SpringBootApplication already include @EnableAutoConfiguration, that means that we don't need to do all configurations which otherwise we would have to do to handle request via Rest controller like configuring DispatcherServlet.

Also note that ,as we have created this controller in new Package and by default Spring is going to check only nl.blogspot.javasolutionsguide.springboot.springbootapp package,we need to tell spring that this new package should also be scanned.For that we need to add following in the SpriingBootAppApplication class at the class level:


So SpringBootAppApplicaiton class will look like below now :

public class SpringBootAppApplication {

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


Step 13:

Now run the SpringBootApplication class again  and now if we hit 8080, we will get "Error Handling" on Web page as below :

Similarly, we can have n number of controllers as per our requirements in our project and can handle the request and send valid responses back to a web page.

That's all Friends on How to create Spring Boot project with Spring Initializer.In subsequent tutorials, we will go through other ways to create Spring boot project.Subscribe for getting next tutorials right in your mailbox.

Thanks for reading.If you liked it ,support me by liking our Facebook page and sharing this post.