【发布时间】:2019-03-01 01:28:23
【问题描述】:
我正在尝试通过扩展默认的 ErrorWebExceptionHandler 在 Spring Boot 2 中创建自己的 ErrorWebExceptionHandler,但我的应用程序无法启动并显示以下消息:
Caused by: java.lang.IllegalArgumentException: Property 'messageWriters' is required
at org.springframework.boot.autoconfigure.web.reactive.error.AbstractErrorWebExceptionHandler.afterPropertiesSet(AbstractErrorWebExceptionHandler.java:214) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]
我的处理程序(Kotlin 代码):
@Component
@Order(-2)
class SampleErrorWebExceptionHandler(
errorAttributes: ErrorAttributes?,
resourceProperties: ResourceProperties?,
errorProperties: ErrorProperties?,
applicationContext: ApplicationContext?
) : DefaultErrorWebExceptionHandler(errorAttributes, resourceProperties, errorProperties, applicationContext) {
override fun logError(request: ServerRequest, errorStatus: HttpStatus) {
// do something
}
}
可能是什么原因?
【问题讨论】:
标签: spring-boot spring-webflux