1.解决springBoot无法返回视图问题。
@Controller
public class helloController {
@RequestMapping("/")
public String sayHello()
{
System.out.print("访问index");
return "login";
}
}
出现问题:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Mon Jan 28 09:19:35 CST 2019
There was an unexpected error (type=Not Found, status=404).
No message available
解决:
加入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
注意:加入依赖后要注意pom.xml是否有红色下划线,若是有红色下划线,注释掉重新加入依赖。(我就是栽在这儿)。