This message was deleted.
# help
s
This message was deleted.
t
Hi @Kamil Rozbicki have you tried using the Spring framework’s own WireMock integration? https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/1.1.4.RELEASE/multi/multi__spring_cloud_contract_wiremock.html This I believe will use the same web container as Spring for WireMock rather than starting a separate one.
k
Hi @Tom Thank you for pointing me to this direction - will give it a go and message here afterwards.
Hi @Tom Sorry for long time it took me to actually try solution you rcommended. I could not get it to work, and from the context of this document it seems its more about @SpringBootTest, not the @SpringBootApplication On the examples I see WebEnvironment.NONE being used, which I cannot do - still need Spring Boot Web (on post 8080) and Wiremock, on same port (8080). Is this possible? I'm starting to consider adding some programmatic solution for TCP port forwarding proxy, but not sure if it will work, until I try. But know already it would not be pretty. Any help welcomed. Thank you for all your time ;)
t
I’m pretty sure there’s a way to get WireMock to share the same web container as Spring, but I’m not an expert on this module as it’s maintained by the Spring Cloud team. Might be worth jumping on their one of their support channels and asking if you can’t find the solution in the docs.
k
Thank you, @Tom - I'll scratch it a little more, and if still no luck, will reach-out to Spring Cloud team. Thanks again for your time.
Hi @Tom Just an FYI, I managed to workaround this issue in an alternative way. Instead of still 'fighting' with SringBoot and trying to make it work on same TCP port as Wiremock, I upgraded Wiremock to version 3.0.1 and utilized one of it's interceptors: StubRequestFilter by implementing my own authentication/authorisation mechanism within it. So now, based on on presence and content of Athorozation header on the received request, I can either do RequestFilterAction.continueWith(request) when all looks good, or serve Unauthorised response with RequestFilterAction.stopWith(generateUnauthorisedResponse()) Thank you again for all your time ;)
t
Great, glad you managed to find a solution! BTW, I would definitely suggest upgrading to 3.3.1. Lots of bug fixes and improvements since 3.0.1.
k
Thank you, will do. Used 'com.github.tomakehurst : wiremock-jre8-standalone : 3.0.1', but will move to 'org.wiremock : wiremock : 3.3.1'. Thanks again and have a nice day!
👍 1