Polish
This commit is contained in:
parent
1e38dd5531
commit
2c1e81adf0
|
@ -69,7 +69,8 @@ public abstract class OnEndpointElementCondition extends SpringBootCondition {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ConditionOutcome getDefaultEndpointsOutcome(ConditionContext context) {
|
protected ConditionOutcome getDefaultEndpointsOutcome(ConditionContext context) {
|
||||||
boolean match = Boolean.valueOf(context.getEnvironment().getProperty(this.prefix + "defaults.enabled", "true"));
|
boolean match = Boolean
|
||||||
|
.parseBoolean(context.getEnvironment().getProperty(this.prefix + "defaults.enabled", "true"));
|
||||||
return new ConditionOutcome(match, ConditionMessage.forCondition(this.annotationType)
|
return new ConditionOutcome(match, ConditionMessage.forCondition(this.annotationType)
|
||||||
.because(this.prefix + "defaults.enabled is considered " + match));
|
.because(this.prefix + "defaults.enabled is considered " + match));
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class ConfigurationPropertiesReportEndpoint implements ApplicationContext
|
||||||
* @param prefix the prefix
|
* @param prefix the prefix
|
||||||
* @return the serialized instance
|
* @return the serialized instance
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean, String prefix) {
|
private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean, String prefix) {
|
||||||
try {
|
try {
|
||||||
return new HashMap<>(mapper.convertValue(bean, Map.class));
|
return new HashMap<>(mapper.convertValue(bean, Map.class));
|
||||||
|
|
|
@ -65,13 +65,11 @@ public class PathMappedEndpoints implements Iterable<PathMappedEndpoint> {
|
||||||
|
|
||||||
private Map<EndpointId, PathMappedEndpoint> getEndpoints(Collection<EndpointsSupplier<?>> suppliers) {
|
private Map<EndpointId, PathMappedEndpoint> getEndpoints(Collection<EndpointsSupplier<?>> suppliers) {
|
||||||
Map<EndpointId, PathMappedEndpoint> endpoints = new LinkedHashMap<>();
|
Map<EndpointId, PathMappedEndpoint> endpoints = new LinkedHashMap<>();
|
||||||
suppliers.forEach((supplier) -> {
|
suppliers.forEach((supplier) -> supplier.getEndpoints().forEach((endpoint) -> {
|
||||||
supplier.getEndpoints().forEach((endpoint) -> {
|
|
||||||
if (endpoint instanceof PathMappedEndpoint) {
|
if (endpoint instanceof PathMappedEndpoint) {
|
||||||
endpoints.put(endpoint.getEndpointId(), (PathMappedEndpoint) endpoint);
|
endpoints.put(endpoint.getEndpointId(), (PathMappedEndpoint) endpoint);
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
return Collections.unmodifiableMap(endpoints);
|
return Collections.unmodifiableMap(endpoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class HealthWebEndpointResponseMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebEndpointResponse<Health> createWebEndpointResponse(Health health) {
|
private WebEndpointResponse<Health> createWebEndpointResponse(Health health) {
|
||||||
Integer status = this.statusHttpMapper.mapStatus(health.getStatus());
|
int status = this.statusHttpMapper.mapStatus(health.getStatus());
|
||||||
return new WebEndpointResponse<>(health, status);
|
return new WebEndpointResponse<>(health, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1059,7 +1059,7 @@ public class RabbitProperties {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.host = input.substring(0, portIndex);
|
this.host = input.substring(0, portIndex);
|
||||||
this.port = Integer.valueOf(input.substring(portIndex + 1));
|
this.port = Integer.parseInt(input.substring(portIndex + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ abstract class RedisConnectionConfiguration {
|
||||||
try {
|
try {
|
||||||
String[] parts = StringUtils.split(node, ":");
|
String[] parts = StringUtils.split(node, ":");
|
||||||
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
|
Assert.state(parts.length == 2, "Must be defined as 'host:port'");
|
||||||
nodes.add(new RedisNode(parts[0], Integer.valueOf(parts[1])));
|
nodes.add(new RedisNode(parts[0], Integer.parseInt(parts[1])));
|
||||||
}
|
}
|
||||||
catch (RuntimeException ex) {
|
catch (RuntimeException ex) {
|
||||||
throw new IllegalStateException("Invalid redis sentinel property '" + node + "'", ex);
|
throw new IllegalStateException("Invalid redis sentinel property '" + node + "'", ex);
|
||||||
|
|
|
@ -44,8 +44,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
|
||||||
* needed, otherwise default converters will be used.
|
* needed, otherwise default converters will be used.
|
||||||
* <p>
|
* <p>
|
||||||
* NOTE: The default converters used are the same as standard Spring MVC (see
|
* NOTE: The default converters used are the same as standard Spring MVC (see
|
||||||
* {@link WebMvcConfigurationSupport#getMessageConverters} with some slight re-ordering to
|
* {@link WebMvcConfigurationSupport}) with some slight re-ordering to put XML converters
|
||||||
* put XML converters at the back of the list.
|
* at the back of the list.
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
|
|
@ -68,10 +68,10 @@ class ArtemisConnectionFactoryFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startEmbeddedJms() {
|
private void startEmbeddedJms() {
|
||||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
for (String embeddedJmsClass : EMBEDDED_JMS_CLASSES) {
|
||||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
if (ClassUtils.isPresent(embeddedJmsClass, null)) {
|
||||||
try {
|
try {
|
||||||
this.beanFactory.getBeansOfType(Class.forName(EMBEDDED_JMS_CLASSES[i]));
|
this.beanFactory.getBeansOfType(Class.forName(embeddedJmsClass));
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
// Ignore
|
// Ignore
|
||||||
|
@ -103,8 +103,8 @@ class ArtemisConnectionFactoryFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmbeddedJmsClassPresent() {
|
private boolean isEmbeddedJmsClassPresent() {
|
||||||
for (int i = 0; i < EMBEDDED_JMS_CLASSES.length; i++) {
|
for (String embeddedJmsClass : EMBEDDED_JMS_CLASSES) {
|
||||||
if (ClassUtils.isPresent(EMBEDDED_JMS_CLASSES[i], null)) {
|
if (ClassUtils.isPresent(embeddedJmsClass, null)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ public class LdapProperties {
|
||||||
Assert.notNull(environment, "Environment must not be null");
|
Assert.notNull(environment, "Environment must not be null");
|
||||||
String localPort = environment.getProperty("local.ldap.port");
|
String localPort = environment.getProperty("local.ldap.port");
|
||||||
if (localPort != null) {
|
if (localPort != null) {
|
||||||
return Integer.valueOf(localPort);
|
return Integer.parseInt(localPort);
|
||||||
}
|
}
|
||||||
return DEFAULT_PORT;
|
return DEFAULT_PORT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,8 +282,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
|
|
||||||
private void customizeStaticResources(ConfigurableTomcatWebServerFactory factory) {
|
private void customizeStaticResources(ConfigurableTomcatWebServerFactory factory) {
|
||||||
ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat().getResource();
|
ServerProperties.Tomcat.Resource resource = this.serverProperties.getTomcat().getResource();
|
||||||
factory.addContextCustomizers((context) -> {
|
factory.addContextCustomizers((context) -> context.addLifecycleListener((event) -> {
|
||||||
context.addLifecycleListener((event) -> {
|
|
||||||
if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
|
if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
|
||||||
context.getResources().setCachingAllowed(resource.isAllowCaching());
|
context.getResources().setCachingAllowed(resource.isAllowCaching());
|
||||||
if (resource.getCacheTtl() != null) {
|
if (resource.getCacheTtl() != null) {
|
||||||
|
@ -291,8 +290,7 @@ public class TomcatWebServerFactoryCustomizer
|
||||||
context.getResources().setCacheTtl(ttl);
|
context.getResources().setCacheTtl(ttl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void customizeErrorReportValve(ErrorProperties error, ConfigurableTomcatWebServerFactory factory) {
|
private void customizeErrorReportValve(ErrorProperties error, ConfigurableTomcatWebServerFactory factory) {
|
||||||
|
|
|
@ -168,16 +168,13 @@ public class UndertowWebServerFactoryCustomizer
|
||||||
return (value) -> this.factory.addBuilderCustomizers((builder) -> builder.setSocketOption(option, value));
|
return (value) -> this.factory.addBuilderCustomizers((builder) -> builder.setSocketOption(option, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
<T> Consumer<Map<String, String>> forEach(Function<Option<T>, Consumer<T>> function) {
|
<T> Consumer<Map<String, String>> forEach(Function<Option<T>, Consumer<T>> function) {
|
||||||
return (map) -> {
|
return (map) -> map.forEach((key, value) -> {
|
||||||
map.forEach((key, value) -> {
|
|
||||||
Option<T> option = (Option<T>) NAME_LOOKUP.get(getCanonicalName(key));
|
Option<T> option = (Option<T>) NAME_LOOKUP.get(getCanonicalName(key));
|
||||||
Assert.state(option != null, "Unable to find '" + key + "' in UndertowOptions");
|
Assert.state(option != null, "Unable to find '" + key + "' in UndertowOptions");
|
||||||
T parsed = option.parseValue(value, getClass().getClassLoader());
|
T parsed = option.parseValue(value, getClass().getClassLoader());
|
||||||
function.apply(option).accept(parsed);
|
function.apply(option).accept(parsed);
|
||||||
});
|
});
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getCanonicalName(String name) {
|
private static String getCanonicalName(String name) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.cli.command.archive;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -175,7 +174,7 @@ abstract class ArchiveCommand extends OptionParsingCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeJar(File file, Class<?>[] compiledClasses, List<MatchedResource> classpathEntries,
|
private void writeJar(File file, Class<?>[] compiledClasses, List<MatchedResource> classpathEntries,
|
||||||
List<URL> dependencies) throws FileNotFoundException, IOException, URISyntaxException {
|
List<URL> dependencies) throws IOException, URISyntaxException {
|
||||||
final List<Library> libraries;
|
final List<Library> libraries;
|
||||||
try (JarWriter writer = new JarWriter(file)) {
|
try (JarWriter writer = new JarWriter(file)) {
|
||||||
addManifest(writer, compiledClasses);
|
addManifest(writer, compiledClasses);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.springframework.boot.cli.command.core;
|
package org.springframework.boot.cli.command.core;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -48,9 +49,7 @@ public class HintCommand extends AbstractCommand {
|
||||||
try {
|
try {
|
||||||
int index = (args.length != 0) ? Integer.parseInt(args[0]) - 1 : 0;
|
int index = (args.length != 0) ? Integer.parseInt(args[0]) - 1 : 0;
|
||||||
List<String> arguments = new ArrayList<>(args.length);
|
List<String> arguments = new ArrayList<>(args.length);
|
||||||
for (int i = 2; i < args.length; i++) {
|
arguments.addAll(Arrays.asList(args).subList(2, args.length));
|
||||||
arguments.add(args[i]);
|
|
||||||
}
|
|
||||||
String starting = "";
|
String starting = "";
|
||||||
if (index < arguments.size()) {
|
if (index < arguments.size()) {
|
||||||
starting = arguments.remove(index);
|
starting = arguments.remove(index);
|
||||||
|
|
|
@ -283,7 +283,7 @@ public class LiveReloadServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runConnection(Connection connection) throws IOException, Exception {
|
private void runConnection(Connection connection) throws Exception {
|
||||||
try {
|
try {
|
||||||
addConnection(connection);
|
addConnection(connection);
|
||||||
connection.run();
|
connection.run();
|
||||||
|
|
|
@ -98,16 +98,14 @@ class PropertiesMigrationReporter {
|
||||||
MultiValueMap<String, PropertyMigration> result = new LinkedMultiValueMap<>();
|
MultiValueMap<String, PropertyMigration> result = new LinkedMultiValueMap<>();
|
||||||
List<ConfigurationMetadataProperty> candidates = this.allProperties.values().stream().filter(filter)
|
List<ConfigurationMetadataProperty> candidates = this.allProperties.values().stream().filter(filter)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
getPropertySourcesAsMap().forEach((name, source) -> {
|
getPropertySourcesAsMap().forEach((name, source) -> candidates.forEach((metadata) -> {
|
||||||
candidates.forEach((metadata) -> {
|
|
||||||
ConfigurationProperty configurationProperty = source
|
ConfigurationProperty configurationProperty = source
|
||||||
.getConfigurationProperty(ConfigurationPropertyName.of(metadata.getId()));
|
.getConfigurationProperty(ConfigurationPropertyName.of(metadata.getId()));
|
||||||
if (configurationProperty != null) {
|
if (configurationProperty != null) {
|
||||||
result.add(name, new PropertyMigration(configurationProperty, metadata,
|
result.add(name,
|
||||||
determineReplacementMetadata(metadata)));
|
new PropertyMigration(configurationProperty, metadata, determineReplacementMetadata(metadata)));
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -351,16 +351,13 @@ public abstract class AbstractApplicationContextRunner<SELF extends AbstractAppl
|
||||||
* @param consumer the consumer of the created {@link ApplicationContext}
|
* @param consumer the consumer of the created {@link ApplicationContext}
|
||||||
* @return this instance
|
* @return this instance
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SELF run(ContextConsumer<? super A> consumer) {
|
public SELF run(ContextConsumer<? super A> consumer) {
|
||||||
withContextClassLoader(this.classLoader, () -> {
|
withContextClassLoader(this.classLoader, () -> this.systemProperties.applyToSystemProperties(() -> {
|
||||||
this.systemProperties.applyToSystemProperties(() -> {
|
|
||||||
try (A context = createAssertableContext()) {
|
try (A context = createAssertableContext()) {
|
||||||
accept(consumer, context);
|
accept(consumer, context);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
return (SELF) this;
|
return (SELF) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.beans.PropertyDescriptor;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -307,7 +308,7 @@ public class MockitoPostProcessor extends InstantiationAwareBeanPostProcessorAda
|
||||||
if (primaryBeanName != null) {
|
if (primaryBeanName != null) {
|
||||||
throw new NoUniqueBeanDefinitionException(type.resolve(), candidateBeanNames.size(),
|
throw new NoUniqueBeanDefinitionException(type.resolve(), candidateBeanNames.size(),
|
||||||
"more than one 'primary' bean found among candidates: "
|
"more than one 'primary' bean found among candidates: "
|
||||||
+ Arrays.asList(candidateBeanNames));
|
+ Collections.singletonList(candidateBeanNames));
|
||||||
}
|
}
|
||||||
primaryBeanName = candidateBeanName;
|
primaryBeanName = candidateBeanName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,10 +181,10 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||||
if (annotation != null) {
|
if (annotation != null) {
|
||||||
String prefix = getPrefix(annotation);
|
String prefix = getPrefix(annotation);
|
||||||
if (element instanceof TypeElement) {
|
if (element instanceof TypeElement) {
|
||||||
processAnnotatedTypeElement(prefix, (TypeElement) element, new Stack<TypeElement>());
|
processAnnotatedTypeElement(prefix, (TypeElement) element, new Stack<>());
|
||||||
}
|
}
|
||||||
else if (element instanceof ExecutableElement) {
|
else if (element instanceof ExecutableElement) {
|
||||||
processExecutableElement(prefix, (ExecutableElement) element, new Stack<TypeElement>());
|
processExecutableElement(prefix, (ExecutableElement) element, new Stack<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ public abstract class ExecutableArchiveLauncher extends Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Iterator<Archive> applyClassPathArchivePostProcessing(Iterator<Archive> archives) throws Exception {
|
private Iterator<Archive> applyClassPathArchivePostProcessing(Iterator<Archive> archives) throws Exception {
|
||||||
List<Archive> list = new ArrayList<Archive>();
|
List<Archive> list = new ArrayList<>();
|
||||||
while (archives.hasNext()) {
|
while (archives.hasNext()) {
|
||||||
list.add(archives.next());
|
list.add(archives.next());
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ public class PropertiesLauncher extends Launcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeProperties() throws Exception, IOException {
|
private void initializeProperties() throws Exception {
|
||||||
List<String> configs = new ArrayList<>();
|
List<String> configs = new ArrayList<>();
|
||||||
if (getProperty(CONFIG_LOCATION) != null) {
|
if (getProperty(CONFIG_LOCATION) != null) {
|
||||||
configs.add(getProperty(CONFIG_LOCATION));
|
configs.add(getProperty(CONFIG_LOCATION));
|
||||||
|
@ -195,7 +195,7 @@ public class PropertiesLauncher extends Launcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadResource(InputStream resource) throws IOException, Exception {
|
private void loadResource(InputStream resource) throws Exception {
|
||||||
this.properties.load(resource);
|
this.properties.load(resource);
|
||||||
for (Object key : Collections.list(this.properties.propertyNames())) {
|
for (Object key : Collections.list(this.properties.propertyNames())) {
|
||||||
String text = this.properties.getProperty((String) key);
|
String text = this.properties.getProperty((String) key);
|
||||||
|
@ -591,7 +591,7 @@ public class PropertiesLauncher extends Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Archive> asList(Iterator<Archive> iterator) {
|
private List<Archive> asList(Iterator<Archive> iterator) {
|
||||||
List<Archive> list = new ArrayList<Archive>();
|
List<Archive> list = new ArrayList<>();
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
list.add(iterator.next());
|
list.add(iterator.next());
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,9 +172,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
|
||||||
MergedAnnotations annotations = MergedAnnotations.from(testClass,
|
MergedAnnotations annotations = MergedAnnotations.from(testClass,
|
||||||
MergedAnnotations.SearchStrategy.TYPE_HIERARCHY);
|
MergedAnnotations.SearchStrategy.TYPE_HIERARCHY);
|
||||||
ClassPathEntryFilter filter = new ClassPathEntryFilter(annotations.get(ClassPathExclusions.class));
|
ClassPathEntryFilter filter = new ClassPathEntryFilter(annotations.get(ClassPathExclusions.class));
|
||||||
List<URL> processedUrls = new ArrayList<>();
|
|
||||||
List<URL> additionalUrls = getAdditionalUrls(annotations.get(ClassPathOverrides.class));
|
List<URL> additionalUrls = getAdditionalUrls(annotations.get(ClassPathOverrides.class));
|
||||||
processedUrls.addAll(additionalUrls);
|
List<URL> processedUrls = new ArrayList<>(additionalUrls);
|
||||||
for (URL url : urls) {
|
for (URL url : urls) {
|
||||||
if (!filter.isExcluded(url)) {
|
if (!filter.isExcluded(url)) {
|
||||||
processedUrls.add(url);
|
processedUrls.add(url);
|
||||||
|
|
|
@ -81,7 +81,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runTestWithModifiedClassPath(ReflectiveInvocationContext<Method> invocationContext,
|
private void runTestWithModifiedClassPath(ReflectiveInvocationContext<Method> invocationContext,
|
||||||
ExtensionContext extensionContext) throws ClassNotFoundException, Throwable {
|
ExtensionContext extensionContext) throws Throwable {
|
||||||
Class<?> testClass = extensionContext.getRequiredTestClass();
|
Class<?> testClass = extensionContext.getRequiredTestClass();
|
||||||
Method testMethod = invocationContext.getExecutable();
|
Method testMethod = invocationContext.getExecutable();
|
||||||
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
|
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
|
||||||
|
@ -95,8 +95,7 @@ class ModifiedClassPathExtension implements InvocationInterceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName)
|
private void runTest(ClassLoader classLoader, String testClassName, String testMethodName) throws Throwable {
|
||||||
throws ClassNotFoundException, Throwable {
|
|
||||||
Class<?> testClass = classLoader.loadClass(testClassName);
|
Class<?> testClass = classLoader.loadClass(testClassName);
|
||||||
Method testMethod = findMethod(testClass, testMethodName);
|
Method testMethod = findMethod(testClass, testMethodName);
|
||||||
LauncherDiscoveryRequest request = new LauncherDiscoveryRequestBuilder(classLoader)
|
LauncherDiscoveryRequest request = new LauncherDiscoveryRequestBuilder(classLoader)
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
import javax.annotation.processing.Processor;
|
import javax.annotation.processing.Processor;
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
|
@ -59,7 +60,7 @@ public class TestCompiler {
|
||||||
this.fileManager = compiler.getStandardFileManager(null, null, null);
|
this.fileManager = compiler.getStandardFileManager(null, null, null);
|
||||||
this.outputLocation = outputLocation;
|
this.outputLocation = outputLocation;
|
||||||
this.outputLocation.mkdirs();
|
this.outputLocation.mkdirs();
|
||||||
Iterable<? extends File> temp = Arrays.asList(this.outputLocation);
|
Iterable<? extends File> temp = Collections.singletonList(this.outputLocation);
|
||||||
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, temp);
|
this.fileManager.setLocation(StandardLocation.CLASS_OUTPUT, temp);
|
||||||
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, temp);
|
this.fileManager.setLocation(StandardLocation.SOURCE_OUTPUT, temp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -521,7 +521,7 @@ public class JettyServletWebServerFactory extends AbstractServletWebServerFactor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Resource addPath(String path) throws IOException, MalformedURLException {
|
public Resource addPath(String path) throws IOException {
|
||||||
if (path.startsWith("/org/springframework/boot")) {
|
if (path.startsWith("/org/springframework/boot")) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue