【发布时间】:2019-03-24 18:05:51
【问题描述】:
当我尝试在 spring initializr 上创建一个演示项目并选择 spring-boot-starter-webflux 时,我无法终生自定义我的错误页面。我尝试将模板放在 /resources/public/error、/resources/templates/error 下(我正在使用 Thymeleaf),定义自定义 ErrorController 无济于事。例如,每次我想抛出 404 页面时,应用程序都会抛出 WhiteLabel 页面。但是当我将依赖项更改为 spring-boot-starter-web 时,它会立即选择我的模板。
是否有其他方式来声明错误页面或者这只是一个错误(当前使用 Spring Boot 2.1.0.RC1,但同样的事情发生在 2.1.0.M4 上)?
我的依赖如下:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
【问题讨论】:
标签: spring-webflux