https://linen.dev logo
#wiremock-java
Title
# wiremock-java
a

Alex Arana

01/10/2024, 5:37 AM
After migrating to Spring Boot 3.x, I switched WireMock use within the application from running embedded via
wiremock-cloud-contract-wiremock
to running as a Docker container using
wiremock-testcontainers-java
. Everything has been smooth sailing except for some legacy Handlebars extensions which I worked around by enabling global response templating within the container instance. However, I noticed that
WireMockContainer
does allow for the loading of external extensions using JAR file references.. has anyone been able to load Handlebars extension instances, as Spring beans, into WireMock docker? In the past, we used
spring-cloud-contract-wiremock
WireMockConfigurationCustomizer to load it programmatically like so:
Copy code
// handlebarsHelper instance is injected by Spring while refreshing the ApplicationContext
    @Bean
    fun wireMockConfigurationCustomizer(
        handlebarsHelper: Helper<Map<String, Any>>
    ) = WireMockConfigurationCustomizer { configuration ->
        configuration.extensions(
            ResponseTemplateTransformer(false, "helper-name", handlebarsHelper)
        )
    }
o

Oleg Nenashev

01/22/2024, 6:02 PM
There were some changes in how Handlebars is shaded, so now you will need the extension to be rebuilt with https://github.com/wiremock/gradle-wiremock-extension-plugins/pull/12 to have it working properly in the standalone mode. FYI @Lee Turner @Tom, is someone looking into this patch?
3 Views