diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java index 6e97a9b0d3..7a2d9a6c52 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigurationImportSelector.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -239,14 +239,12 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector, private List filter(List configurations, AutoConfigurationMetadata autoConfigurationMetadata) { long startTime = System.nanoTime(); String[] candidates = StringUtils.toStringArray(configurations); - boolean[] skip = new boolean[candidates.length]; boolean skipped = false; for (AutoConfigurationImportFilter filter : getAutoConfigurationImportFilters()) { invokeAwareMethods(filter); boolean[] match = filter.match(candidates, autoConfigurationMetadata); for (int i = 0; i < match.length; i++) { if (!match[i]) { - skip[i] = true; candidates[i] = null; skipped = true; } @@ -257,7 +255,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector, } List result = new ArrayList<>(candidates.length); for (int i = 0; i < candidates.length; i++) { - if (!skip[i]) { + if (candidates[i] != null) { result.add(candidates[i]); } } @@ -266,7 +264,7 @@ public class AutoConfigurationImportSelector implements DeferredImportSelector, logger.trace("Filtered " + numberFiltered + " auto configuration class in " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime) + " ms"); } - return new ArrayList<>(result); + return result; } protected List getAutoConfigurationImportFilters() {