Utility methods in BeanFactoryAnnotationUtils, which was introduced in Spring 3.1.2, throw IllegalStateException; whereas, utility methods in the existing BeanFactoryUtils consistently throw specific subclasses of BeansException.
This inconsistency between BeanFactoryAnnotationUtils and BeanFactoryUtils makes it difficult to handle exceptions in a unified manner.
For example, it would be much more suitable for BeanFactoryAnnotationUtils.qualifiedBeanOfType() to throw a NoSuchBeanDefinitionException rather than an IllegalStateException.
Deliverables
Refactor BeanFactoryAnnotationUtils to consistently throw specific subclasses of BeansException.
Sam Brannen opened SPR-9652 and commented
Status Quo
Utility methods in
BeanFactoryAnnotationUtils
, which was introduced in Spring 3.1.2, throwIllegalStateException
; whereas, utility methods in the existingBeanFactoryUtils
consistently throw specific subclasses ofBeansException
.This inconsistency between
BeanFactoryAnnotationUtils
andBeanFactoryUtils
makes it difficult to handle exceptions in a unified manner.For example, it would be much more suitable for
BeanFactoryAnnotationUtils.qualifiedBeanOfType()
to throw aNoSuchBeanDefinitionException
rather than anIllegalStateException
.Deliverables
BeanFactoryAnnotationUtils
to consistently throw specific subclasses ofBeansException
.Affects: 3.1.2
Referenced from: commits 7ebfd9e, 430db26
The text was updated successfully, but these errors were encountered: