Spring Cloud Gateway 之 Only one connection receive subscriber allowed

都說Spring Cloud Gateway好,我也來試試,但是配置了老是報下面這個錯誤:java

java.lang.IllegalStateException: Only one connection receive subscriber allowed.

困擾了我幾天的問題,原來這是 Spring Boot 2.0.5 以上版本的坑,最終從GitHub上找到了答案:git

一、一種變相的解決方法:github

@Bean
    public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
        return new HiddenHttpMethodFilter() {
            @Override
            public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) {
                return chain.filter(exchange);
            }
        };
    }

原文:https://github.com/spring-projects/spring-boot/issues/14509spring

二、另一方法是降級爲 Spring Boot 2.0.4ide

原文:https://github.com/spring-cloud/spring-cloud-gateway/issues/541spring-boot

相關文章
相關標籤/搜索