What You'll Learn

You should have already created a Spring Boot application with the web dependency.

Now, right-click on the new folder and create a new HTML file. Call it "index.html" and add some content. We are going to use charity donations as our example domain, so let's have a simple home page for our donations application.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Welcome to Charity Giving</title>
</head>
<body>
<div>
    <h1>Welcome to Charity Giving</h1>
    <div>
        <a href="charities">View our charities</a>
    </div>
</div>

</body>
</html>

There are many available.

Run the Spring Boot application using the bootRun method.

Go to http://localhost:8080 in a browser of your choice.

You will see the page. Spring Boot routes to the index.html page as you would expect. At this point, you may need to enable the LiveReload plug-in. There is normally an icon in the browser toolbar to do this.

Leave the server running.

Make a change to the HTML page.

Execute gradle > build > classes. In IntelliJ, CTRL+F9 can also be used. See previous tutorial for configuration details.

The change should appear in the browser automatically. This is Live Reload in action. If you examine the server log, you will see that a Live Reload server is started for you. This is because we included DevTools in the project.