Revised NoSuchBeanDefinitionException message for proper array class names
Issue: SPR-14595
This commit is contained in:
parent
4b06b60007
commit
022b013563
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
|
@ -17,6 +17,7 @@
|
|||
package org.springframework.beans.factory;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -74,7 +75,7 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
* @param message detailed message describing the problem
|
||||
*/
|
||||
public NoSuchBeanDefinitionException(Class<?> type, String message) {
|
||||
super("No qualifying bean of type [" + type.getName() + "] is defined: " + message);
|
||||
super("No qualifying bean of type [" + ClassUtils.getQualifiedName(type) + "] is defined: " + message);
|
||||
this.beanType = type;
|
||||
}
|
||||
|
||||
|
@ -85,7 +86,8 @@ public class NoSuchBeanDefinitionException extends BeansException {
|
|||
* @param message detailed message describing the problem
|
||||
*/
|
||||
public NoSuchBeanDefinitionException(Class<?> type, String dependencyDescription, String message) {
|
||||
super("No qualifying bean of type [" + type.getName() + "] found for dependency" +
|
||||
super("No qualifying bean" + (!StringUtils.hasLength(dependencyDescription) ?
|
||||
" of type [" + ClassUtils.getQualifiedName(type) + "]" : "") + " found for dependency" +
|
||||
(StringUtils.hasLength(dependencyDescription) ? " [" + dependencyDescription + "]" : "") +
|
||||
": " + message);
|
||||
this.beanType = type;
|
||||
|
|
|
@ -1420,7 +1420,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
checkBeanNotOfRequiredType(type, descriptor);
|
||||
|
||||
throw new NoSuchBeanDefinitionException(type, dependencyDescription,
|
||||
"expected at least 1 bean which qualifies as autowire candidate for this dependency. " +
|
||||
"expected at least 1 bean which qualifies as autowire candidate. " +
|
||||
"Dependency annotations: " + ObjectUtils.nullSafeToString(descriptor.getAnnotations()));
|
||||
}
|
||||
|
||||
|
@ -1667,7 +1667,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto
|
|||
sources.add(factoryMethod);
|
||||
}
|
||||
Class<?> targetType = beanDefinition.getTargetType();
|
||||
if (targetType != null && !targetType.equals(obj.getClass())) {
|
||||
if (targetType != null && targetType != obj.getClass()) {
|
||||
sources.add(targetType);
|
||||
}
|
||||
return sources.toArray(new Object[sources.size()]);
|
||||
|
|
Loading…
Reference in New Issue