Использую SpringBoot + thymeleaf, проект стартует без ошибок, но при заходе на localhost:8080 в браузере отображает ошибку Whitelabel Error Page.
pom.xml
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
WebController.java
public class WebController {
@Value("${welcome.message:test}")
private String message = "Hello world";
@RequestMapping("/")
public String welcome(Map<String, Object> model) {
model.put("message",this.message);
return "welcome";
}
}
src/main/resources/templates/welcome.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Spring Boot Thymeleaf Hello World Example</title>
</head>
<body>
<div>
<h1>Spring Boot Web Thymeleaf Example</h1>
<h2>
<span th:text="'Message: ' + ${message}"></span>
</h2>
</div>
</body>
</html>
application.properties
welcome.message: Hello Mkyong
Подскажите, что я не правильно делаю.