Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring WebFlux application running tomcat instead of Netty

I'm running a spring boot WebFlux application, normally the application run on top of a Netty Embedded server. Instead, i'm getting a tomcat instance running, i've tried to exclude tomcat from my pom and still getting the same problem.

So i would like to fix this by running Netty instead of Tomcat.

Here is my pom dependencies:

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>

    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
    </dependency>

    <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct-processor</artifactId>
    </dependency>

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
    </dependency>

    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-test</artifactId>
        <scope>test</scope>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>
like image 621
Mehdi Benmesssaoud Avatar asked Oct 15 '25 10:10

Mehdi Benmesssaoud


2 Answers

As stated by Thomas, springfox doesn't support webflux.

I would recommend using the OpenApi implementation provided by springDoc instead of SpringFox which still provides the same UI, uses swagger 3 and also supports webflux.

    <dependency>
        <groupId>org.springdoc</groupId>
        <artifactId>springdoc-openapi-webflux-ui</artifactId>
        <version>1.2.33</version>
    </dependency>
like image 113
123 Avatar answered Oct 18 '25 00:10

123


Springfox version 2.9.2 does not have webflux support.

Springfox 3.0.0 that includes webflux support is available as a snapshot, but will soon be released.

You can read more about it here.

https://github.com/springfox/springfox/issues/2699

like image 24
Toerktumlare Avatar answered Oct 17 '25 23:10

Toerktumlare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!