I am attempting to use the WebFlux reactive types in a new Spring Boot App. I used the initializr at https://start.spring.io and selected the 2.0.0-SNAPSHOT version. I added the web reactive dependency and everything I did worked great. This was a really solid POC, the goal was how to make use of these types to modernize our APIs, to do this, we planned to slowly replace each portion of blocking and/or synchronous process and replace it with a non-blocking alternative implementation.
The problem I have is when I try to evolve my POC into something more akin to the services we have in production many things don't appear to be working. Now I understand that webflux is not GA yet, and that I shouldn't expect fully reactive support from all of the other spring projects yet. I do however recall when webflux was still called web-reactive that you could run on undertow/jetty/netty/tomcat/etc but now that I am using the webflux starter, everything defaults to netty, and I don't see the docs calling out how to change that to the embedded tomcat that our other services are currently using.
Is it still possible to use the spring-boot-starter-webflux with other app containers, or do I now need to manually bootstrap webflux to work with a something other than netty?
You can exclude spring-boot-starter-reactor-netty
from the spring-boot-starter-webflux
dependency and use spring-boot-starter-tomcat
, spring-boot-starter-undertow
or spring-boot-starter-jetty
instead.
If your objective is to use tomcat server then It is not necessary to exclude spring-boot-starter-reactor-netty. Adding spring boot starter tomcat will start the application in Tomcat server.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<exclusions>
<!-- Exclude the Netty dependency -->
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-reactor-netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Use Tomcat instead -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With