Javatpoint Logo
Javatpoint Logo

Spring Boot Hello World Example

In the section, we will create a Maven project for Hello Word Example. We need the following tools and technologies to develop the same.

  • Spring Boot 2.2.2.RELEASE
  • JavaSE 1.8
  • Maven 3.3.9

Step 1: Open Spring Initializr

Step 2: Provide the Group name. We have provided com.javatpoint.

Step 3: Provide the Artifact Id. We have provided the spring-boot-hello-world-example.

Step 4: Add the dependency Spring Web.

Step 5: Click on the Generate button. When we click on the Generate button, it wraps all the specifications into a jar file and downloads it to our local system.

Spring Boot Hello World Example

Step 6: Extract the RAR file.

Step 7: Import the project folder by using the following steps:

File -> Import -> Existing Maven Project -> Next -> Browse -> Select the Project Folder -> Finish

When the project imports successfully, it shows the following project directory in the Package Explorer section of the IDE.

Spring Boot Hello World Example

Step 8: Create a package with the name com.javatpoint.controller inside the folder src/main/java.

Step 9: Create a Controller class with the name HelloWorldController.

Step 10: Create a method named hello() that returns a String.

Step 11: Run the file.

When the application runs successfully, it shows a massage in the console, as shown in the following figure.

Spring Boot Hello World Example

Step 12: Open the browser and invoke the URL https://localhost:8080. It returns a String that we have specified in the Controller.

Spring Boot Hello World Example

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA