I've been trying to use the new programmatic bean registration features in Spring Framework 7, but found some limitations with the BeanRegistry API.
For example, it's not possible to configure a scope for the bean. It's only possible to mark a bean as prototype() or else it will be singleton. But across the Spring ecosystem there are more than just those two scopes (e.g. the Spring Boot DevTools support the restart scope). I haven't found any way to customize the underlying BeanDefinition.
Since the BeanRegistry is an interface, I looked into whether it was possible to provide a custom implementation instead of the default BeanRegistryAdapter. But since BeanRegistryAdapter is used explicitly in the code, it's not really possible to contribute a different BeanRegistry implementation.
I opened this issue to make sure I understood the scenario correctly and to ask if it's possible to allow providing a custom BeanRegistry implementation or perhaps make it possible from the BeanRegistry.Spec to customize the underlying BeanDefinition (e.g. by adding a new .customize(Consumer<BeanDefinition>) method).
Thank you!