Make sure NoUniqueBeanDefinitionException to be serializable
See gh-29753
This commit is contained in:
parent
ca14202d78
commit
1b409d5290
|
|
@ -21,6 +21,7 @@ import java.io.ObjectInputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
|
@ -215,7 +216,7 @@ public class DependencyDescriptor extends InjectionPoint implements Serializable
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public Object resolveNotUnique(ResolvableType type, Map<String, Object> matchingBeans) throws BeansException {
|
public Object resolveNotUnique(ResolvableType type, Map<String, Object> matchingBeans) throws BeansException {
|
||||||
throw new NoUniqueBeanDefinitionException(type, matchingBeans.keySet());
|
throw new NoUniqueBeanDefinitionException(type, new HashSet<>( matchingBeans.keySet() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
|
@ -1296,7 +1297,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
||||||
return new NamedBeanHolder<>(candidateName, (T) beanInstance);
|
return new NamedBeanHolder<>(candidateName, (T) beanInstance);
|
||||||
}
|
}
|
||||||
if (!nonUniqueAsNull) {
|
if (!nonUniqueAsNull) {
|
||||||
throw new NoUniqueBeanDefinitionException(requiredType, candidates.keySet());
|
throw new NoUniqueBeanDefinitionException(requiredType, new HashSet<>(candidates.keySet()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue