maciejwalkowiak / wiremock-spring-boot

WireMock Spring Boot drastically simplifies testing HTTP clients in Spring Boot & Junit 5 based integration tests.
MIT License
218 stars 13 forks source link

Spring 3.2.0 Incompatibility #21

Closed LitschiW closed 8 months ago

LitschiW commented 8 months ago

Basically this: https://github.com/wiremock/wiremock/issues/2395

As far as I understood Spring 3.2.0 uses jetty 12 instead of 11 (which is used by wiremock), creating an incompatibility that manifests itself as:

java.lang.NoClassDefFoundError: jakarta/servlet/DispatcherType

This is solveable by replacing the wiremock dependency with wiremock-standalone:

     <dependency>
            <groupId>com.maciejwalkowiak.spring</groupId>
            <artifactId>wiremock-spring-boot</artifactId>
            <version>2.0.0</version>
            <scope>test</scope>
            <exclusions>                
                <exclusion>
                    <groupId>org.wiremock</groupId>
                    <artifactId>wiremock</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wiremock</groupId>
            <artifactId>wiremock-standalone</artifactId>
            <version>3.3.1</version>
            <scope>test</scope>
        </dependency>

However, I don't know which drawbacks this brings with itself.

To be fair, this is definetly a wiremock problem. I just wanted to leave my solution here in case anyone else comes across this error. And maybe to track the issue in the context of this repository.

maciejwalkowiak commented 8 months ago

Thanks for bringing it up. I am aware of this problem in Wiremock but haven't had time yet to update this project. I think standalone variant is safer anyway as it avoids any potential collisions on the class path.

myou11 commented 8 months ago

Hi @maciejwalkowiak, I ran into this issue yesterday and was wondering if a new version could be pushed out for usage with springboot 3.2.x please? I can use the manual solution above in the meantime 👍