Merge branch '3.3.x' into 3.4.x
Closes gh-44968
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user