File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
wiremock-spring-boot/src/main/java/com/maciejwalkowiak/wiremock/spring Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1212import org .slf4j .LoggerFactory ;
1313
1414import org .springframework .boot .test .util .TestPropertyValues ;
15- import org .springframework .context .ApplicationListener ;
1615import org .springframework .context .ConfigurableApplicationContext ;
1716import org .springframework .context .event .ContextClosedEvent ;
1817import org .springframework .core .env .Environment ;
@@ -82,9 +81,11 @@ private void resolveOrCreateWireMockServer(ConfigurableApplicationContext contex
8281 Store .INSTANCE .store (context , options .name (), newServer );
8382
8483 // add shutdown hook
85- context .addApplicationListener ((ApplicationListener <ContextClosedEvent >) event -> {
86- LOGGER .info ("Stopping WireMockServer with name '{}'" , options .name ());
87- newServer .stop ();
84+ context .addApplicationListener (event -> {
85+ if (event instanceof ContextClosedEvent ) {
86+ LOGGER .info ("Stopping WireMockServer with name '{}'" , options .name ());
87+ newServer .stop ();
88+ }
8889 });
8990
9091 // configure Spring environment property
You can’t perform that action at this time.
0 commit comments