Spring Boot Project using Spring Initializr API

In my previous articles of Spring Boot,Β I have covered the introduction of Spring Boot , Its advantages, limitations, goals, features etc and the Key Components of the Spring Boot.

If you have not read my introduction article of Spring Boot, I would request you to take a look – Β Spring Boot Tutorial.

There exists following ways to create Spring Boot project. We can use any of below mentioned approach to create Spring Boot Application :

We have already covered in previous article about How to install and configure Spring Boot in eclipse IDE and develop the Spring Boot Maven projectΒ Β and also How to develop Spring Boot Application using Spring Starter Project Wizard.

Now, We are going to cover the third way i.e. “Spring Initializr API in this article. In our next articles, we will cover remaining ways to create Spring Boot Application.

Spring Boot Project using Spring Initializr API

We are using Eclipse IDE for the below example. It is very popular IDE for java projects. You can download it from here.

Let’s get started :

Step 1 : Generate Project usingΒ Spring Initializr

Spring InitializrΒ is a web tool provided by The Spring team on official site. It is very easy to generate projects using this API, we just need to provide project details and dependencies and Project is ready to be downloaded.

  • Go to URL :Β https://start.spring.io/
  • Fill out the Project name, package etc.
  • Select the dependency “Spring Web” from the Dependencies option.
  • Click on Generate the Project.

Spring Initializr API

Now the Project must have been downloaded into your System in .zip format. Extract the Project.

Step 2 : Import Generated Project into Eclipse

Go to File >> Import >> Maven >> Existing Maven Projects and click on Next :

Spring Initializr API

Now Browse and Select the extracted Project and click on Finish:

Spring Initializr API

Now, We can see our Project structure generated by the Spring Initializr API and created pom.xml :

Spring Initializr API
Don’t worry about the error symbol shown in image, It is just my XML definition error. Nothing Important.

pom.xml :

		<!-- lookup parent from repository -->
	<description>Demo project for Spring Boot</description>

Also Spring API Initializr has also created the main app class for our Project :

Spring Initializr API

Step 3 :Β Create the controller for Hello World Example

Now, create class inside the src/main/java package in your project :

Spring Initializr API


  • Add theΒ @ControllerΒ annotation class level.
  • Create a method that returns String .
  • AddΒ @RequestMapping(β€œ/”)Β andΒ @ResponseBodyΒ  annotation at this method.

Spring Initializr API

  • @ControllerΒ indicates that class is a Controller.
  • @RequestMappingΒ Β annotation maps HTTP requests to handler methods of controllers.
  • @ResponseBodyΒ is annotation which binds the method return value to the web response body.

Step 4 :Β Running the Application

Now we have completed all tasks so it’s time to test our application by running it :

Spring Initializr API

Output :

Spring Initializr API


That’s all folks! In this article,Β  we have learnt How to develop the Spring Boot Application using ‘Spring Boot Initializr API’.

Newsletter Updates

Enter your name and email address below to subscribe to our newsletter

Leave a Reply