https://linen.dev logo
#help
Title
j

Jason Anderson

08/29/2023, 5:59 PM
Howdy. Does Wiremock have support for (or plans to support) Spring Boot 3? Specifically I've got
'com.github.tomakehurst:wiremock-standalone:2.27.2'
and
'de.mkammerer.wiremock-junit5:wiremock-junit5:1.1.0'
as dependencies. I just updated my app to Spring boot 3.0.10 from 2.7.14 which drops support for javax and moves to jakarta and for my main application that was easy-enough to update. However, many tests still fail with:
Copy code
LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/Users/ME/.gradle/caches/modules-2/files-2.1/com.github.tomakehurst/wiremock-standalone/2.27.2/327647a19b2319af2526b9c33a5733a2241723e0/wiremock-standalone-2.27.2.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.slf4j.helpers.NOPLoggerFactory
I've tried switching from 2.27.2 to various later beta versions (like 3.0.0-beta-10) which give different errors such as :
java.lang.NoClassDefFoundError: Could not initialize class com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory
Any help would be appreciated. I'm still pretty new to the Java world so I apologize if some of this is straight forward.
o

Oleg Nenashev

08/29/2023, 6:59 PM
Hi! First of all, why don't you use https://github.com/maciejwalkowiak/wiremock-spring-boot in such a case? Secondly
Could not initialize class com.github.tomakehurst.wiremock.jetty9.JettyHttpServerFactory
definitely comes from WireMock 2.x and not 3.x
wiremock-spring-boot is built for Spring Boot 3
j

Jason Anderson

08/29/2023, 7:07 PM
1. I'll take a look at that. Didn't know it was available. 2. I wonder if I missed updating my dependencies before re-running the tests. Anyway, thanks.
o

Oleg Nenashev

08/29/2023, 7:13 PM
FWIW the 3.0.0 release is out there, silent launch https://github.com/wiremock/wiremock/releases/tag/3.0.0
šŸ‘€ 1
j

Jason Anderson

08/30/2023, 9:05 PM
@Oleg Nenashev thanks for the help! Using wiremock-spring-boot instead made the migration much easier.
šŸ‘ 1
o

Oleg Nenashev

08/31/2023, 4:14 AM
Thanks for the feedback! I will make sure to document it after all
@Jason Anderson I updated the description manually and created https://github.com/wiremock/wiremock-docker/issues/77 for fixing automation
j

Jason Anderson

08/31/2023, 2:11 PM
Sure thing. To be clear, I was able to remove these two test dependencies: ā€¢
com.github.tomakehurst:wiremock-standalone:2.27.2
ā€¢
de.mkammerer.wiremock-junit5:wiremock-junit5:1.1.0
with
com.maciejwalkowiak.spring:wiremock-spring-boot:1.0.1
. I did have to make some changes in test code such as: ā€¢
@EnableWireMock
paired with
@ConfigureWireMock
ā€¢ Replacing
@RegisterExtension
with
@InjetWireMock
But that was about it.
o

Oleg Nenashev

08/31/2023, 3:23 PM
WireMock JUnit 5 it should not be required anymore. WireMock has JUnit 5 support since long ago
šŸ‘ 1