我们知道在SpringBoot中可以在@Controller类下的 @RequestMapping("")下的方法中根据return可以跳转到resources/templates下的html页面。但是你这里要注意一点必须是使用@Controller的Controller类,**绝对不可以使用@RestController,使用@RestController是无效的。 **
1 pom文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.zxf</groupId>
<artifactId>spring_boot_0828</artifactId>
<version>