diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java index db7141de82..8ab3572ef2 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/ImportCandidates.java @@ -73,12 +73,12 @@ public final class ImportCandidates implements Iterable { ClassLoader classLoaderToUse = decideClassloader(classLoader); String location = String.format(LOCATION, annotation.getName()); Enumeration urls = findUrlsInClasspath(classLoaderToUse, location); - List autoConfigurations = new ArrayList<>(); + List importCandidates = new ArrayList<>(); while (urls.hasMoreElements()) { URL url = urls.nextElement(); - autoConfigurations.addAll(readAutoConfigurations(url)); + importCandidates.addAll(readCandidateConfigurations(url)); } - return new ImportCandidates(autoConfigurations); + return new ImportCandidates(importCandidates); } private static ClassLoader decideClassloader(ClassLoader classLoader) { @@ -93,15 +93,14 @@ public final class ImportCandidates implements Iterable { return classLoader.getResources(location); } catch (IOException ex) { - throw new IllegalArgumentException("Failed to load autoconfigurations from location [" + location + "]", - ex); + throw new IllegalArgumentException("Failed to load configurations from location [" + location + "]", ex); } } - private static List readAutoConfigurations(URL url) { + private static List readCandidateConfigurations(URL url) { try (BufferedReader reader = new BufferedReader( new InputStreamReader(new UrlResource(url).getInputStream(), StandardCharsets.UTF_8))) { - List autoConfigurations = new ArrayList<>(); + List candidates = new ArrayList<>(); String line; while ((line = reader.readLine()) != null) { line = stripComment(line); @@ -109,12 +108,12 @@ public final class ImportCandidates implements Iterable { if (line.isEmpty()) { continue; } - autoConfigurations.add(line); + candidates.add(line); } - return autoConfigurations; + return candidates; } catch (IOException ex) { - throw new IllegalArgumentException("Unable to load autoconfigurations from location [" + url + "]", ex); + throw new IllegalArgumentException("Unable to load configurations from location [" + url + "]", ex); } }