Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection refused with Spring Boot Starter Webflux #274

Open
mikrethor opened this issue Oct 19, 2024 · 2 comments · May be fixed by #275
Open

Connection refused with Spring Boot Starter Webflux #274

mikrethor opened this issue Oct 19, 2024 · 2 comments · May be fixed by #275

Comments

@mikrethor
Copy link

For my tests I use com.epages:restdocs-api-spec-restassured and my application is developed with spring-boot-starter-webflux unfortunately restdocs-api-spec contains spring-boot-starter-web and it makes the tests fails with a connection refused so my test is not working.

For my use case I use the maven plugin

<groupId>io.github.berkleytechnologyservices</groupId>
<artifactId>restdocs-spec-maven-plugin</artifactId>

And the latest version (0.19.4).

So to make it work I exclude spring-boot-starter-web from restdocs-api-spec with the following code :

<dependency>
            <groupId>com.epages</groupId>
            <artifactId>restdocs-api-spec</artifactId>
            <version>${restdocs-api-spec.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-web</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

The code doesn't need to include the spring-boot-starter-web it can just use spring framework dependencies spring-web and spring-context.

@mikrethor mikrethor linked a pull request Oct 19, 2024 that will close this issue
@mikrethor
Copy link
Author

@earthfall
Copy link

I suffered the same problem with this; wrong webflux dependency on the spring-boot-starter-web.
After further analysis, spring-boot-starter-web has implicit dependency on the tomcat server and does not work with built-in webflux's netty server.

I solved it by excluding webflux dependency from restdocs-api-spec library but author's solution seems to be more appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants