这个问题的一些答案包括:但是接口HandlerInterceptor处理javax‘HttpServletRequest和HttpServletResponse,它们不像Spring引入的新类那样实用,即ServerWebExchange (参见下面代码中setLocation()的用法),它出现在一个名字听起来很有前途的接口org.springframework.web.server.WebFilter中@Component
public class LegacyRestRedirectWeb
在我的WebFlux应用程序(带注释的控制器)中,我注意到如果从@RestController方法抛出异常,则执行@ControllerAdvice中的@ExceptionHandler并正确处理异常。但是,如果异常较早发生,例如在WebFilter中,则不执行处理程序。我阅读了WebFlux文档,发现了以下内容:
However, keep in mind that, in WebFlux, you cannot use a @ControllerA
在非反应式应用程序中,我们可以使用SecurityContextHolder.getContext().setAuthentication(authentication);以编程方式对请求进行身份验证Webflux的等价物是什么?public class ReactiveServiceAuthenticationFilter implements WebFilter {
private final ReactiveAuthenticationManager