Skip to content

Allow BeanRegistrar to access already registered bean definitions #35475

@DanielLiu1123

Description

@DanielLiu1123

Description

As a framework developer, I want BeanRegistrar to provide access to already registered bean definitions, so that I can implement more flexible registration logic based on the current context.

Background

I attempted to migrate the automatic registration of HttpExchange interfaces in httpexchange-spring-boot-starter from BeanDefinitionRegistryPostProcessor to BeanRegistrar. During this process, I discovered an issue:
When using BeanDefinitionRegistryPostProcessor, I was able to see which bean definitions were already registered. This allowed me to skip the automatic registration for a given type if the user had already provided their own bean.

This capability is particularly important when users are not satisfied with the automatically registered beans or wish to customize them further. If BeanRegistrar could offer similar functionality, it would enable a putIfAbsent-like behavior, providing a better balance between user customization and automatic registration.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions