您现在的位置是:首页 > 博文答疑 > Springboot: 报This application has no exp博文答疑

Springboot: 报This application has no exp

Leo2023-08-16【5】

简介Springboot: 报This application has no explicit mapping for /error

Controller控制器使用@RestController可以正确返回数据,但当使用@Controller时不能返回页面,报错如下

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

解决方法:检查下pom.xml里对应的依赖include了没有。

        <!-- SpringBoot集成thymeleaf模板 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>