diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index b975b0e77c..38e4608dbb 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -53,7 +53,6 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.beans.factory.support.DefaultBeanNameGenerator; import org.springframework.boot.BootstrapRegistry.InstanceSupplier; -import org.springframework.boot.SpringApplicationHooks.Action; import org.springframework.boot.SpringApplicationHooks.Hook; import org.springframework.boot.availability.AvailabilityChangeEvent; import org.springframework.boot.availability.AvailabilityState; @@ -115,6 +114,7 @@ import org.springframework.test.context.support.TestPropertySourceUtils; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; +import org.springframework.util.function.ThrowingSupplier; import org.springframework.web.context.ConfigurableWebEnvironment; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.support.StandardServletEnvironment; @@ -1270,7 +1270,8 @@ class SpringApplicationTests { SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); given(hook.preRefresh(eq(application), any(ConfigurableApplicationContext.class))).willReturn(true); - this.context = SpringApplicationHooks.withHook(hook, (Action) application::run); + this.context = SpringApplicationHooks.withHook(hook, + (ThrowingSupplier) application::run); then(hook).should().preRun(application); then(hook).should().preRefresh(application, this.context); then(hook).should().postRun(application, this.context); @@ -1282,7 +1283,8 @@ class SpringApplicationTests { Hook hook = mock(Hook.class); SpringApplication application = new SpringApplication(ExampleConfig.class); application.setWebApplicationType(WebApplicationType.NONE); - this.context = SpringApplicationHooks.withHook(hook, (Action) application::run); + this.context = SpringApplicationHooks.withHook(hook, + (ThrowingSupplier) application::run); then(hook).should().preRun(application); then(hook).should().preRefresh(application, this.context); then(hook).should().postRun(application, this.context);