Spring Framework

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 expected type.

Rod Johnson, Juergen Hoeller
See Also:
Serialized Form

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

Constructor Detail


public BeanNotOfRequiredTypeException(java.lang.String beanName,
                                      java.lang.Class requiredType,
                                      java.lang.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 java.lang.String getBeanName()
Return the name of the instance that was of the wrong type.


public java.lang.Class getRequiredType()
Return the expected type for the bean.


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

Spring Framework