Tuesday, 17 December 2019

Introduction to Spring WebFlux


Prerequisite
a.   Basic Idea of reactor
b.   Basic idea of spring REST and core
c.    Basics of MonogDB

Spring WebFlux is a reactive web framework for spring.

Is Spring WebFlux is a replacement for Spring MVC?
No. Go through below points to get some clarity.

a.   Spring MVC is based on Servlet API, where are Spring WebFlux is based on Reactive Streams.
b.   Spring WebFlux uses non-blocking APIs available in servlet 3.1+ specification onwards, where as Spring MVC uses blocking APIs. That means spring MVC uses synchronous programming model, where as WebFlux uses asynchronous programming model.
c.    Since Spring MVC depends on old servlet specification, one dedicated thread is given per request. But in case of WebFlux a pool of worker threads are responsible to execute given task.

Can I use Spring MVC and WebFlux together in same web application?
Yes

Note
a. At the time of writing this Tutorial, spring data has reactive support for below databases.
         a. Cassandra
         b. Redis
         c. MongoDB
         d. Couchbase


Previous                                                    Next                                                    Home

No comments:

Post a Comment