How to use the Spring WebClient with Jetty, instead of Netty?

后端 未结 2 752
既然无缘
既然无缘 2021-01-18 10:22

According to the documentation it is possible to use the Spring Reactive WebClient with a different server as Netty:

WebClient provides a higher level

2条回答
  •  野的像风
    2021-01-18 11:27

    Add dependency:

    org.eclipse.jetty:jetty-reactive-httpclient:1.0.3
    

    And then:

    HttpClient httpClient = new HttpClient();
    ClientHttpConnector connector = new JettyClientHttpConnector(httpClient);
    
    WebClient webClient = WebClient.builder().clientConnector(connector).build();
    

    Source: https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#webflux-client-builder-jetty

提交回复
热议问题