diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java index b00121071f2..744c04d3f4a 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/annotation/Configurations.java @@ -90,9 +90,8 @@ public abstract class Configurations { protected Configurations(UnaryOperator>> sorter, Collection> classes, Function, String> beanNameGenerator) { Assert.notNull(classes, "Classes must not be null"); - sorter = (sorter != null) ? sorter : UnaryOperator.identity(); - Collection> sorted = sorter.apply(classes); this.sorter = (sorter != null) ? sorter : UnaryOperator.identity(); + Collection> sorted = this.sorter.apply(classes); this.classes = Collections.unmodifiableSet(new LinkedHashSet<>(sorted)); this.beanNameGenerator = beanNameGenerator; }