Class 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:
  • Constructor Details

    • BeanNotOfRequiredTypeException

      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 Details

    • getBeanName

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

      public Class<?> getRequiredType()
      Return the expected type for the bean.
    • getActualType

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