SpringBoot Web项目时,发现页面无法返回HTML页面,显示服务器500错误。#
1.在经过查找后发现,将Controller类的@Controller标签换成@RestController后,再次运行,浏览器可以返回正常的数据,但是只能打印后台数据,仍然无法返回html页面代码。
2.发现代码中提示错误,无法解决MVC View。百度后发现,pom.xml缺少了依赖,代码如下:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
添加依赖后,发现项目运行恢复正常。🆗