Class BeanDefinitionOverrideException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.beans.BeansException
- org.springframework.beans.FatalBeanException
- org.springframework.beans.factory.BeanDefinitionStoreException
- org.springframework.beans.factory.support.BeanDefinitionOverrideException
- All Implemented Interfaces:
Serializable
public class BeanDefinitionOverrideException extends BeanDefinitionStoreException
Subclass ofBeanDefinitionStoreException
indicating an invalid override attempt: typically registering a new definition for the same bean name whileDefaultListableBeanFactory.isAllowBeanDefinitionOverriding()
isfalse
.
Constructor Summary
Constructors Constructor Description BeanDefinitionOverrideException(String beanName, BeanDefinition beanDefinition, BeanDefinition existingDefinition)
Create a new BeanDefinitionOverrideException for the given new and existing definition.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BeanDefinition
getBeanDefinition()
Return the newly registered bean definition.String
getBeanName()
Return the name of the bean.BeanDefinition
getExistingDefinition()
Return the existing bean definition for the same name.String
getResourceDescription()
Return the description of the resource that the bean definition came from.Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMessage, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
BeanDefinitionOverrideException
public BeanDefinitionOverrideException(String beanName, BeanDefinition beanDefinition, BeanDefinition existingDefinition)
Create a new BeanDefinitionOverrideException for the given new and existing definition.- Parameters:
beanName
- the name of the beanbeanDefinition
- the newly registered bean definitionexistingDefinition
- the existing bean definition for the same name
Method Detail
getResourceDescription
@NonNull public String getResourceDescription()
Return the description of the resource that the bean definition came from.- Overrides:
getResourceDescription
in classBeanDefinitionStoreException
getBeanName
@NonNull public String getBeanName()
Return the name of the bean.- Overrides:
getBeanName
in classBeanDefinitionStoreException
getBeanDefinition
public BeanDefinition getBeanDefinition()
Return the newly registered bean definition.- See Also:
getBeanName()
getExistingDefinition
public BeanDefinition getExistingDefinition()
Return the existing bean definition for the same name.- See Also:
getBeanName()