Spring Boot Hello World Example

In this post we will provide a basic example of how to get started using Spring Boot, with a Spring Boot Hello World Example.

Setup:

First, create a new maven project with the following content in your pom file.

Replacing the groupId, artifactId and version as needed. You can create the following package structure and classes as shown in the image below.

Spring Boot Hello World Example:

We need to create our Application context object.

Now create the HelloWorldResource, which is responsible to handle user requests.

Create your application entry point using theĀ SpringApplication class.

Running the application

Start the application and in your browser go to http://localhost:8080. Then you should be able to see

 

If you have any questions, do let me know

Similar posts:

  1. Logging with MDC
  2. HttpClient configuration example
  3. Calling REST API with CURL
  4. Java 8 Stream map example

References:

  1. Spring Boot Getting Started

Leave a Reply