【发布时间】:2017-09-30 02:18:15
【问题描述】:
在我的 Spring Boot 应用程序中,我有以下 pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<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>
</dependencies>
作为控制器,我有一个简单的如下:
@Controller
public class ThyemeleafController {
@RequestMapping("/")
public String home() {
return "home";
}
}
然后我在src/main/resources/templates 中有一个简单的home.html,其中包含helloWorld。但是当我运行应用程序并转到 url:
http://localhost:8080/
它抱怨:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Sep 29 17:15:13 GMT-12:00 2017
There was an unexpected error (type=Not Found, status=404).
No message available
【问题讨论】:
标签: spring maven spring-mvc spring-boot