Bootstrap application

Our sample application uses Spring Boot. Spring WebFlux runs on a Reactor Netty server within Spring Boot by default. Our Spring Boot class is very basic and is as follows:

@SpringBootApplication
public class Run {
public static void main(String[] args) {
SpringApplication.run(Run.class, args);
}
}

You can run the application on any other server, apart from Spring Boot, and it is quite easy to achieve. We have a separate project named spring-boot-tomcat-webflux that runs on Spring Boot, but rather than running on Reactor Netty, it runs on a Tomcat server.

No change is required in any part of the code, apart from pom.xml:

<!--Spring Framework and Spring Boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-reactor-netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--Explicit Tomcat dependency-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>

From the spring-boot-starter-webflux artifact, exclude Reactor Netty. Thereafter, explicitly add the Tomcat dependency, spring-boot-starter-tomcat. The rest of the pom.xml is kept intact. For other server runtimes, such as Undertow, Jetty, and so on, the approach is similar to the one detailed here.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.248.1