what is the right way to handle errors in spring-webflux

前端 未结 6 2058
轮回少年
轮回少年 2020-12-09 11:12

I\'ve been doing some research using spring-webflux and I like to understand what should be the right way to handle errors using Router Functions.

I\'ve created an s

6条回答
  •  失恋的感觉
    2020-12-09 12:05

    What I am currently doing is simply providing a bean my WebExceptionHandler :

    @Bean
    @Order(0)
    public WebExceptionHandler responseStatusExceptionHandler() {
        return new MyWebExceptionHandler();
    }
    

    The advantage than creating the HttpHandler myself is that I have a better integration with WebFluxConfigurer if I provide my own ServerCodecConfigurer for example or using SpringSecurity

提交回复
热议问题