diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationPropertiesEnvironmentPostProcessorTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationPropertiesEnvironmentPostProcessorTests.java
index 4cacb3e54df..923663232dd 100644
--- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationPropertiesEnvironmentPostProcessorTests.java
+++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/integration/IntegrationPropertiesEnvironmentPostProcessorTests.java
@@ -25,7 +25,6 @@ import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
-import io.lettuce.core.dynamic.support.ReflectionUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
@@ -48,6 +47,7 @@ import org.springframework.integration.context.IntegrationProperties;
import org.springframework.mock.env.MockEnvironment;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.util.ClassUtils;
+import org.springframework.util.ReflectionUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
diff --git a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java
index 075e096c49d..9d87da982e3 100644
--- a/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java
+++ b/spring-boot-tests/spring-boot-integration-tests/spring-boot-server-tests/src/intTest/java/org/springframework/boot/context/embedded/EmbeddedServerContainerInvocationContextProvider.java
@@ -18,6 +18,7 @@ package org.springframework.boot.context.embedded;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Constructor;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -41,11 +42,12 @@ import org.junit.jupiter.api.extension.ParameterContext;
import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.jupiter.api.extension.TestTemplateInvocationContext;
import org.junit.jupiter.api.extension.TestTemplateInvocationContextProvider;
-import org.junit.platform.commons.util.ReflectionUtils;
+import org.springframework.beans.BeanUtils;
import org.springframework.boot.testsupport.BuildOutput;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.util.FileSystemUtils;
+import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.client.NoOpResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
@@ -119,10 +121,17 @@ class EmbeddedServerContainerInvocationContextProvider
if (cachedLauncher != null) {
return cachedLauncher;
}
- AbstractApplicationLauncher launcher = ReflectionUtils.newInstance(launcherClass, application,
- new File(buildOutput.getRootLocation(), "app-launcher-" + UUID.randomUUID()));
- this.launcherCache.put(cacheKey, launcher);
- return launcher;
+ try {
+ Constructor extends AbstractApplicationLauncher> constructor = ReflectionUtils
+ .accessibleConstructor(launcherClass, Application.class, File.class);
+ AbstractApplicationLauncher launcher = BeanUtils.instantiateClass(constructor, application,
+ new File(buildOutput.getRootLocation(), "app-launcher-" + UUID.randomUUID()));
+ this.launcherCache.put(cacheKey, launcher);
+ return launcher;
+ }
+ catch (NoSuchMethodException ex) {
+ throw new IllegalStateException("Launcher class %s does not have an (Application, File) constructor");
+ }
}
private Application getApplication(EmbeddedServletContainerTest annotation, String container) {
diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml
index 19f4c9e4696..6ec9f685df0 100644
--- a/src/checkstyle/checkstyle.xml
+++ b/src/checkstyle/checkstyle.xml
@@ -16,7 +16,7 @@
+ value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^org.springframework.context.annotation.ScannedGenericBeanDefinition, ^reactor\.core\.support\.Assert, ^(?!org\.springframework\.util\.).*ReflectionUtils"/>