Spring Boot Hello World ExampleIn the section, we will create a Maven project for Hello Word Example. We need the following tools and technologies to develop the same.
Step 1: Open Spring Initializr https://start.spring.io/. 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. 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. 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. HelloWorldController.java Step 11: Run the SpringBootHelloWorldExampleApplication.java file. SpringBootHelloWorldExampleApplication.java When the application runs successfully, it shows a massage in the console, as shown in the following figure. Step 12: Open the browser and invoke the URL https://localhost:8080. It returns a String that we have specified in the Controller. Next TopicProject Deployment Using Tomcat |