Spring Boot web application for beginners.
Spring Boot is one of the widely used backend frameworks for developing web applications. It also helps the developer to build an application in a quick and simple way.

And this post will help you to start with setting up a spring boot application and run it in 5 easy steps

Although there are many ways to create a Spring Boot application, we will be using “Spring Initializr”.

Step 1: Go to https://start.spring.io/. Select Maven as Project, Java as language, and latest spring boot version.

To create a web application using Spring Boot, we need to add Web dependency to our project in the “Dependencies” section.

Spring Web dependency

Step 2: Select Project metadata, Packaging, and Java version. Use the “Generate” button to save/download the project. And extract the project to a folder.

Project Metadata

Step 3: Import maven project in IDE (I am using Eclipse IDE) as follows

File → Import → Maven → Existing Maven Projects (Click Next)

In Root Directory, browse to your project i.e. (example-application) and click “Finish”

import maven project in eclipse

Step 4: Create “TestController.java” as follows.

TestController.java code snippet

Step 5: Run “ExampleApplication.java” as a Java application. Go to browser and type “http://localhost:8080/test/hello-world”

Spring Boot application runs on 8080 port by default

Congratulation

Congratulation!!! Your first Spring Boot application is ready now for more fun stuff!!!

Note: If you face “Maven unknown error” while importing a project into Eclipse IDE, try this.

Found it Interesting?

Please show your support by 👏.

Disclaimer:

I myself have just started learning, Spring Boot. If you find any issues please feel free to post them in the comments section below. Thank you for reading so far 😄
['Mohammed Shehzad']
['Spring Boot', 'Begginer', 'Web Development']