Switching from Embedded Netty to Apache Tomcat

By default, Spring Boot is geared up to use embedded Netty (http://netty.io). Why? Because it's one of the most popular solutions for reactive applications. And when it comes to reactive applications, it's critical that the entire stack be reactive.

However, it's possible to switch to another embedded container. We can experiment with using Apache Tomcat and its asynchronous Servlet 3.1 API. All we have to do is to make some tweaks to the dependency settings in build.gradle, as follows:

 compile('org.springframework.boot:spring-boot-starter-webflux') { exclude group: 'org.springframework.boot', module: 'spring-boot-starter-reactor-netty' } compile('org.springframework.boot:spring-boot-starter-tomcat') ...

Get Learning Spring Boot 2.0 - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.