从Spring-Boot 2.0.1升级到2.0.2后,我注意到请求处理线程名称已更改。而且,看起来现在有更多专用于HTTP请求处理的线程。经过一番实验之后,我可以看到在四核服务器上,我们现在拥有:
借助于Spring 2.0.1引导我记得只有4历时负责处理传入的请求和Web客户反应的反应器-HTTP-nio- *线程- https://docs.spring.io/spring/docs/5.0.6.RELEASE /spring-framework-reference/web-reactive.html#webflux-concurrency-model。
我试图ErrorWebExceptionHandler通过扩展默认启动项在Spring Boot 2中创建自己的启动项,但是我的应用程序无法以以下消息启动:
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]
Run Code Online (Sandbox Code Playgroud)
我的处理程序(科特琳代码):
@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
}
}
Run Code Online (Sandbox Code Playgroud)
可能是什么原因?