Rohit sharma
Rohit sharma

Reputation: 71

Is it possible to integrate Spring WebFlux with Spring 4.3?

I have Spring project running on version 4.3. I want to use some async (Fully non blocking) Web-client to make http request to other external servers to fetch some data.

Spring WebFlux seems to be one solution, but it is available in Spring version 5.0.

So just interested in knowing that is it possible to use Spring WebFlux with version 4.3 of Spring.

Or Is there any alternative library which does the same thing as Spring WebFlux and works with Spring 4.3.

Upvotes: 0

Views: 603

Answers (2)

Alexander Pankin
Alexander Pankin

Reputation: 3955

You could use reactor-netty http client with Spring 4.3. Spring WebFlux uses it internally too.

Example from oficial documentation:

    String response =
            HttpClient.create()
                      .get()
                      .uri("http://example.com/")
                      .responseContent() 
                      .aggregate()       
                      .asString()        
                      .block();

Upvotes: 1

Toerktumlare
Toerktumlare

Reputation: 14820

The first sentence in the spring Webflux documentation states

The original web framework included in the Spring Framework, Spring Web MVC, was purpose-built for the Servlet API and Servlet containers. The reactive-stack web framework, Spring WebFlux, was added later in version 5.0.

So no, its a hard requirement that you must use spring framework 5

Upvotes: 1

Related Questions