This post walks you through the process of creating a Hello World example with Spring Boot, Thymeleaf.

Hello Spring Boot Series:
- Spring Boot Hello World Example with FreeMarker
- Spring Boot Hello World Example with Thymeleaf
- Spring Boot Hello World Example with JSP

What you'll build

What you'll need

  • JDK 1.7 or later
  • Maven 3 or later

Stack

  • Spring Boot
  • Java

Project structure

├── src
│   └── main
│       ├── java
│       │   └── com
│       │       └── hellokoding
│       │           └── springboot
│       │               ├── HelloController.java
│       │               └── WebApplication.java
│       └── resources
│           ├── templates
│           │   └── hello.html
│           └── application.properties
└── pom.xml

Project dependencies


Hello Controller

Controller maps HTTP Requests with View.


@RequestMapping maps /hello request to hello() method.

name is a query string parameter of /hello request.

Model object passes value to hello view (hello.html).

View Template


Application Configuration



Run

mvn spring-boot:run

Source code

[email protected]:hellokoding/springboot-thymeleaf.git https://github.com/hellokoding/springboot-thymeleaf

You may also like the Hello Spring MVC Series:
- Spring MVC 4 Hello World Example with XML Configuration, Maven and JSP
- Spring MVC 4 Hello World Example with XML Configuration, Maven, and Thymeleaf

Serving Web Content with Spring MVC

If you have found the post useful, please consider making a donation on paypal, following hellokoding.com on github / facebook / twitter / google+, and sharing this post.