Phate
Phate

Reputation: 6612

Difference between spring-boot-starter-web and spring-boot-starter-webflux?

I tried including one of said dependencies at the time but I can't find any difference:

So, what am I missing? Using spring boot 2.2.5-RELEASE.

Upvotes: 6

Views: 6699

Answers (1)

vicpermir
vicpermir

Reputation: 3702

If you check the official documentation there is a small section that, I think, should answer your question:

1.1.4. Applicability

Spring MVC or WebFlux?

A natural question to ask but one that sets up an unsound dichotomy. Actually, both work together to expand the range of available options. The two are designed for continuity and consistency with each other, they are available side by side, and feedback from each side benefits both sides. The following diagram shows how the two relate, what they have in common, and what each supports uniquely:

mvc and webflux venn

You can even add both and it will default to a regular Spring MVC web application but will let you use the new WebClient introduced in Spring 5. This behaviour is described, among other places, here:

Both web frameworks mirror the names of their source modules (spring-webmvc and spring-webflux) and co-exist side by side in the Spring Framework. Each module is optional. Applications can use one or the other module or, in some cases, both — for example, Spring MVC controllers with the reactive WebClient.

I'm not an expert on this but, like you, I was curious about the shared bits of both and the reasoning behind it. You can find more information here:

Upvotes: 8

Related Questions