How to create and run Spring Boot application in easy steps

How to create and run Spring Boot application in easy steps

How to create and run Spring Boot application in easy steps

In this blog, we will set up our first Spring Boot example and learn how to run Spring Boot application quickly. If you are new to Spring Boot this article could be a starting point for your Boot journey. Follow this article carefully, without skipping any step. For ease, we have created simple steps with screenshots that you can follow. Best way to understand this article is by opening your favorite IDE and getting your hands dirty 🙂

Now, the question comes what is run Spring Boot application and how does it help you in programming. In this blog, we’ll try to cover this with an example along with few more questions a novice developer might have

What you’ll learn

Application Setup

1. Open IDE(we are using STS in this example). Go to File ->New ->Spring Starter Project.

How to create and run Spring Boot application in easy steps -1

2. Provide the necessary details as below.

3. You can select the Starter projects like we have selected Spring Web Starter below.

run Spring Boot application

4. Click finish and you’ll notice that project structure is created for your application. 

Run Spring Boot application

Running a Spring Boot application is very easy. Remember that you dont have to create/deploy a war file, instead the application is going to be run as simple Java app. To run this application, simply right click on project ->Run As -> Java Application.


2019-07-01 08:24:17.722 INFO 12624 — [ main] c.e.demo.FirstSpringBootAppApplication : Started FirstSpringBootAppApplication in 2.46 seconds (JVM running for 3.772)

Enhance with CommandLineRunner

CommandLineRunner is a simple interface in Spring Boot framework which has a run method. This method is called during initialization phase of the app, as soon as the application comes up. All the class implementing this interface will execute run() during this initialization. Lets take a look at the sample program below – 

Short Notes

In the article above we heard about few key terms while learning about run Spring Boot application. Lets try to cover a short description about them as well. 

Spring Boot

is built on top of Spring framework, and allows developers to build Production ready code very rapidly. When you use Boot in your projects you dont have to be troubled with a lot of configurations, XMLs etc. No need to worry about adding dependencies either. Also, Spring Boot comes bundled with inbuilt server, so you dont have to worry about deploying yout project as war in the external servers like Tomcat.

Important points to remember

As we summarize the article, lets go through the important points to remember again –

  • To setup a Spring Boot application, just go to starter-project-parent and select the type of project you want to set up.
  • A Boot aplication can be run in the same way as a simple java program.
  • A class implementing CommandLineRunner will run as soon as application boots up.

Related interview questions

Here’s a list of other related questions on this topic that could be asked in technical interviews –

  1. How to run Spring Boot application?

Spring Boot application can be set up as a Java project in simple steps described above. It can be run from the Eclipse IDE or via command(in the same way you’ll run a plain java program).

2. What is the use of Spring Boot Starter Parent?

The main benefit of using Spring Boot is that it makes your development process faster. How? – by having a set of inbuilt starters which are a convenient set of dependency descriptors that you can include in your project. For example starters of REST, Spring MVC, Web, etc.

3. When should you use a Spring Boot?

Spring boot applications can be run like any other java application from command line. To run Spring Boot application you’ll need to first build and package your Spring Boot project into an executable jar. We’ll create a separate article here describing the process soon.

4. How do we run Spring Boot Application from a Command Line?

Spring Boot Framework is mainly used to reduce Development, Unit Test and Integration Test time and to ease the development of Production quality apps. It provides starter/descriptors to achieve this goal of setting up new projects within no time.


Hope by now you’ve understood how to setup and run Spring Boot application. Besides, we tried to explain why to use the Boot framework, and applicability. Fee free to comment in case you have any query.
Please feel free to ask your questions in the comments section and let us know if you feel the article has helped you in understanding How to create and run Spring Boot application in easy steps concept better. 



Was this page helpful? Please use the commenting form below to ask any questions or to make a comment. Please do not put the same comment multiple times. Your comment will appear after some time. Also please note that we do not reply to emails or comments on social media. So if you have any question, please put it in the form below and we will try to reply to it as soon as possible. If you are facing any issue with the code provided in the blog, please be as specific with your requirements as possible and share the complete stack trace with us. We usually reply within a day. 

Please follow and like us:
Pin Share

Leave a Reply

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