Skip to content

Commit 4504eff

Browse files
committed
Update ArtifactDetector.java
1 parent 4abde5d commit 4504eff

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

microsphere-core/src/main/java/io/microsphere/classloading/ArtifactDetector.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
77

8+
import javax.annotation.Nonnull;
9+
import javax.annotation.Nullable;
810
import java.net.URL;
911
import java.util.Iterator;
1012
import java.util.LinkedHashSet;
@@ -14,6 +16,7 @@
1416
import java.util.StringJoiner;
1517

1618
import static io.microsphere.net.URLUtils.normalizePath;
19+
import static io.microsphere.util.ClassLoaderUtils.getDefaultClassLoader;
1720
import static io.microsphere.util.ClassPathUtils.getBootstrapClassPaths;
1821
import static io.microsphere.util.ServiceLoaderUtils.loadServicesList;
1922
import static java.lang.System.getProperty;
@@ -36,14 +39,14 @@ public class ArtifactDetector {
3639

3740
private static final List<ArtifactResolver> ARTIFACT_INFO_RESOLVERS = loadServicesList(ArtifactResolver.class, DEFAULT_CLASS_LOADER);
3841

39-
private final ClassLoader classLoader;
42+
private final @Nonnull ClassLoader classLoader;
4043

4144
public ArtifactDetector() {
4245
this(DEFAULT_CLASS_LOADER);
4346
}
4447

45-
public ArtifactDetector(ClassLoader classLoader) {
46-
this.classLoader = classLoader;
48+
public ArtifactDetector(@Nullable ClassLoader classLoader) {
49+
this.classLoader = classLoader == null ? getDefaultClassLoader() : classLoader;
4750
}
4851

4952
public List<Artifact> detect() {

0 commit comments

Comments
 (0)