Add a landing page in spring boot

In this blog, we can see how to add a landing page in spring boot applications. Normally we are using the spring boot for developing the micro service, And that micro service usually return the JSON response, it does not return the any HTML or JSP response.

When you are developing the monolithic application view file and back end code there in the same package. But in micro services we just have only the back end code and it just returns the JSON response. And for view we may use some other Java script frameworks like Angular, React etc. Some time you may require to add multiple view file in your spring boot application.

Example, if you are integrating the any payment gateway, you have to define some end point to handle the payment success and error response. In that case you need to have the view file in spring boot package or security reason. Or some time you want to add welcome page, you can add it. Spring boot allows us to add view file in your application.

Here view file mean, the file which contains the HTML code. that file may be HTMl file or JSP file. You can add all your html files inside the static folder which is there in the resource folder. Here I gave steps with screenshot, You refer it to add welcome in your spring boot application.

If you do not have idea about how to create the spring boot application visit my article

Here I explained how can we show the index.html or landing page.

Project folder structure.

Add new html index.html


<!DOCTYPE html>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
<h1>Hello!. This is my spring boot application</h1>

Go to browser http://localhost:8080/