类 NoSuchBeanDefinitionException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.beans.BeansException
- org.springframework.beans.factory.NoSuchBeanDefinitionException
- 所有已实现的接口:
Serializable
public class NoSuchBeanDefinitionException extends BeansException
Exception thrown when aBeanFactory
is asked for a bean instance for which it cannot find a definition. This may point to a non-existing bean, a non-unique bean, or a manually registered singleton instance without an associated bean definition.- 作者:
- Rod Johnson, Juergen Hoeller, Stephane Nicoll
- 另请参阅:
BeanFactory.getBean(String)
,BeanFactory.getBean(Class)
,NoUniqueBeanDefinitionException
, 序列化表格
构造器概要
构造器 构造器 说明 NoSuchBeanDefinitionException(Class<?> type)
Create a newNoSuchBeanDefinitionException
.NoSuchBeanDefinitionException(Class<?> type, String message)
Create a newNoSuchBeanDefinitionException
.NoSuchBeanDefinitionException(Class<?> type, String dependencyDescription, String message)
已过时。as of 4.3.4, in favor ofNoSuchBeanDefinitionException(ResolvableType, String)
NoSuchBeanDefinitionException(String name)
Create a newNoSuchBeanDefinitionException
.NoSuchBeanDefinitionException(String name, String message)
Create a newNoSuchBeanDefinitionException
.NoSuchBeanDefinitionException(ResolvableType type)
Create a newNoSuchBeanDefinitionException
.NoSuchBeanDefinitionException(ResolvableType type, String message)
Create a newNoSuchBeanDefinitionException
.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 String
getBeanName()
Return the name of the missing bean, if it was a lookup by name that failed.Class<?>
getBeanType()
Return the required type of the missing bean, if it was a lookup by type that failed.int
getNumberOfBeansFound()
Return the number of beans found when only one matching bean was expected.ResolvableType
getResolvableType()
Return the requiredResolvableType
of the missing bean, if it was a lookup by type that failed.从类继承的方法 org.springframework.beans.BeansException
equals, hashCode
从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
构造器详细资料
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(String name)
Create a newNoSuchBeanDefinitionException
.- 参数:
name
- the name of the missing bean
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(String name, String message)
Create a newNoSuchBeanDefinitionException
.- 参数:
name
- the name of the missing beanmessage
- detailed message describing the problem
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(Class<?> type)
Create a newNoSuchBeanDefinitionException
.- 参数:
type
- required type of the missing bean
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(Class<?> type, String message)
Create a newNoSuchBeanDefinitionException
.- 参数:
type
- required type of the missing beanmessage
- detailed message describing the problem
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(ResolvableType type)
Create a newNoSuchBeanDefinitionException
.- 参数:
type
- full type declaration of the missing bean- 从以下版本开始:
- 4.3.4
NoSuchBeanDefinitionException
public NoSuchBeanDefinitionException(ResolvableType type, String message)
Create a newNoSuchBeanDefinitionException
.- 参数:
type
- full type declaration of the missing beanmessage
- detailed message describing the problem- 从以下版本开始:
- 4.3.4
NoSuchBeanDefinitionException
@Deprecated public NoSuchBeanDefinitionException(Class<?> type, String dependencyDescription, String message)
已过时。as of 4.3.4, in favor ofNoSuchBeanDefinitionException(ResolvableType, String)
Create a newNoSuchBeanDefinitionException
.- 参数:
type
- required type of the missing beandependencyDescription
- a description of the originating dependencymessage
- detailed message describing the problem
方法详细资料
getBeanName
public String getBeanName()
Return the name of the missing bean, if it was a lookup by name that failed.
getBeanType
public Class<?> getBeanType()
Return the required type of the missing bean, if it was a lookup by type that failed.
getResolvableType
public ResolvableType getResolvableType()
Return the requiredResolvableType
of the missing bean, if it was a lookup by type that failed.- 从以下版本开始:
- 4.3.4
getNumberOfBeansFound
public int getNumberOfBeansFound()
Return the number of beans found when only one matching bean was expected. For a regular NoSuchBeanDefinitionException, this will always be 0.