Class BeanNotOfRequiredTypeException

  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.springframework.core.NestedRuntimeException
                  extended by org.springframework.beans.BeansException
                      extended by org.springframework.beans.factory.BeanNotOfRequiredTypeException
All Implemented Interfaces:
Direct Known Subclasses:

public class BeanNotOfRequiredTypeException
extends BeansException

Thrown when a bean doesn't match the required type.

Rod Johnson
See Also:
Serialized Form

Constructor Summary
BeanNotOfRequiredTypeException(String beanName, Class requiredType, Class actualType)
          Create a new BeanNotOfRequiredTypeException.
Method Summary
 Class getActualType()
          Return the actual type of the instance found.
 String getBeanName()
          Return the name of the instance that was of the wrong type.
 Class getRequiredType()
          Return the required type for the bean.
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getCause, getMessage, printStackTrace, printStackTrace
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public BeanNotOfRequiredTypeException(String beanName,
                                      Class requiredType,
                                      Class actualType)
Create a new BeanNotOfRequiredTypeException.

beanName - the name of the bean requested
requiredType - the required type
actualType - the actual type returned, which did not match the expected type
Method Detail


public String getBeanName()
Return the name of the instance that was of the wrong type.


public Class getRequiredType()
Return the required type for the bean.


public Class getActualType()
Return the actual type of the instance found.

Copyright (c) 2002-2007 The Spring Framework Project.