在我的SpringWebflux应用程序中,我有一个带@ControllerAdvice注释的类,它实现了WebExceptionHandler,并将其@Order设置为-2,我的想法是让它成为一个全局异常处理程序如下所示:@Slf4j@ControllerAdvice
public class CustomWebExceptionHandler implements WebExceptionHandler
在我的WebFlux应用程序(带注释的控制器)中,我注意到如果从@RestController方法抛出异常,则执行@ControllerAdvice中的@ExceptionHandler并正确处理异常。我阅读了WebFlux文档,发现了以下内容:
However, keep in mind that, in WebFlux, you cannot use a @ControllerAdvice to
我使用spring 2.1.1版本并使用@EnableWebFlux,但是我遇到了一些错误。Initialization of bean failed; nested exception is java.lang.IllegalStateException: The Java/XML config for SpringMVC and SpringWebFlux cannot both be enabled, e.g. via @EnableWebMvc and @EnableWebFlux, in the sa