Skip to content

Commit e239753

Browse files
committed
Merge branch '6.0.x'
2 parents ff104b6 + 1af259f commit e239753

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/NoUniqueBeanDefinitionException.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
1616

1717
package org.springframework.beans.factory;
1818

19+
import java.util.ArrayList;
1920
import java.util.Arrays;
2021
import java.util.Collection;
2122

@@ -61,7 +62,7 @@ public NoUniqueBeanDefinitionException(Class<?> type, Collection<String> beanNam
6162
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
6263
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
6364
this.numberOfBeansFound = beanNamesFound.size();
64-
this.beanNamesFound = beanNamesFound;
65+
this.beanNamesFound = new ArrayList<>(beanNamesFound);
6566
}
6667

6768
/**
@@ -83,7 +84,7 @@ public NoUniqueBeanDefinitionException(ResolvableType type, Collection<String> b
8384
super(type, "expected single matching bean but found " + beanNamesFound.size() + ": " +
8485
StringUtils.collectionToCommaDelimitedString(beanNamesFound));
8586
this.numberOfBeansFound = beanNamesFound.size();
86-
this.beanNamesFound = beanNamesFound;
87+
this.beanNamesFound = new ArrayList<>(beanNamesFound);
8788
}
8889

8990
/**

0 commit comments

Comments
 (0)