Spring Boot Helloworld

To create a springboot helloworld service, first, you need to create a new Spring Boot project using start.spring.io below screenshot is for the reference.



Once we selected all the required options then we can click on generate button, then project will be downloaded, next import the project in any IDE, it will looks like below.

Once you have created your project, open the main application class and add the following code:


                    package com.sb.hello;

                    import org.springframework.boot.SpringApplication;
                    import org.springframework.boot.autoconfigure.SpringBootApplication;

                    @SpringBootApplication
                    public class HelloworldApplication {

                        public static void main(String[] args) {
                            SpringApplication.run(HelloworldApplication.class, args);
                            System.out.println("helloworld");
                        }
                    }                                                
                  

This code imports the necessary Spring Boot classes and annotations, creates a new Spring Boot application, inside the main method add the print statement to print the "helloword". Next right click on the project and click on Run as Sprintboot application then will be able to see the helloworld on the console. This is very simple and basic example of spring boot application.