|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2022 the original author or authors. |
|
|
|
* Copyright 2002-2023 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -22,7 +22,6 @@ import java.util.Collections; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.Enumeration; |
|
|
|
import java.util.stream.Stream; |
|
|
|
import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.context.index.CandidateComponentsIndexLoader; |
|
|
|
|
|
|
|
import org.springframework.core.io.Resource; |
|
|
|
import org.springframework.core.io.Resource; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
|
|
|
|
|
|
|
|
@ -40,7 +39,7 @@ public class CandidateComponentsTestClassLoader extends ClassLoader { |
|
|
|
* if resources are present at the standard location. |
|
|
|
* if resources are present at the standard location. |
|
|
|
* @param classLoader the classloader to use for all other operations |
|
|
|
* @param classLoader the classloader to use for all other operations |
|
|
|
* @return a test {@link ClassLoader} that has no index |
|
|
|
* @return a test {@link ClassLoader} that has no index |
|
|
|
* @see CandidateComponentsIndexLoader#COMPONENTS_RESOURCE_LOCATION |
|
|
|
* @see org.springframework.context.index.CandidateComponentsIndexLoader#COMPONENTS_RESOURCE_LOCATION |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static ClassLoader disableIndex(ClassLoader classLoader) { |
|
|
|
public static ClassLoader disableIndex(ClassLoader classLoader) { |
|
|
|
return new CandidateComponentsTestClassLoader(classLoader, |
|
|
|
return new CandidateComponentsTestClassLoader(classLoader, |
|
|
|
@ -87,8 +86,9 @@ public class CandidateComponentsTestClassLoader extends ClassLoader { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
|
|
|
|
@SuppressWarnings({ "deprecation", "removal" }) |
|
|
|
public Enumeration<URL> getResources(String name) throws IOException { |
|
|
|
public Enumeration<URL> getResources(String name) throws IOException { |
|
|
|
if (CandidateComponentsIndexLoader.COMPONENTS_RESOURCE_LOCATION.equals(name)) { |
|
|
|
if (org.springframework.context.index.CandidateComponentsIndexLoader.COMPONENTS_RESOURCE_LOCATION.equals(name)) { |
|
|
|
if (this.resourceUrls != null) { |
|
|
|
if (this.resourceUrls != null) { |
|
|
|
return this.resourceUrls; |
|
|
|
return this.resourceUrls; |
|
|
|
} |
|
|
|
} |
|
|
|
|