Skip to content

BeanFactoryAnnotationUtils should throw BeansException [SPR-9652] #14286

@spring-projects-issues

Description

@spring-projects-issues

Sam Brannen opened SPR-9652 and commented

Status Quo

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

  1. Refactor BeanFactoryAnnotationUtils to consistently throw specific subclasses of BeansException.

Affects: 3.1.2

Referenced from: commits 7ebfd9e, 430db26

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions