Skip to content

Commit 07a1aea

Browse files
remeiosbrannen
authored andcommitted
Skip array sort when the length of array not greater than 1
Closes gh-30934
1 parent da7b68a commit 07a1aea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ else if (type.isArray()) {
14721472
}
14731473
TypeConverter converter = (typeConverter != null ? typeConverter : getTypeConverter());
14741474
Object result = converter.convertIfNecessary(matchingBeans.values(), resolvedArrayType);
1475-
if (result instanceof Object[] array) {
1475+
if (result instanceof Object[] array && array.length > 1) {
14761476
Comparator<Object> comparator = adaptDependencyComparator(matchingBeans);
14771477
if (comparator != null) {
14781478
Arrays.sort(array, comparator);

0 commit comments

Comments
 (0)