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.

Comment From: sdeleuze

I understand this kind of need, but the current design does not allow this kind of feature, see all the discussion on #21497 for more context.