Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow chained BeanRegistry registration #34557

Closed

Conversation

philwebb
Copy link
Member

@philwebb philwebb commented Mar 9, 2025

Whilst looking at the new BeanRegistry API it struck me that it might be useful to allow several register calls to be chained together. For example, I might have some custom utility that is itself implements BeanRegistrar. If we add a BeanRegistry.register(BeanRegistrar registar) method I think it will help user to compose registartions.

E.g.:

class MyBeanRegistrar implements BeanRegistrar {

    void register(BeanRegistry registry, Environment env) {
        registry.register(MyCustomScannerThatIsAlsoABeanRegistrar.scan("some.package.for.things.i.know"));
    }

}

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 9, 2025
@philwebb philwebb force-pushed the registration-chaining branch 2 times, most recently from eb604b6 to c1a9526 Compare March 9, 2025 01:32
Add a `register(BeanRegistry registry)` method to `BeanRegistry`
to allow registration chaining.
@philwebb philwebb force-pushed the registration-chaining branch from c1a9526 to bd88554 Compare March 9, 2025 03:30
@sdeleuze sdeleuze self-assigned this Mar 10, 2025
@sdeleuze sdeleuze added the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 10, 2025
@sdeleuze sdeleuze added this to the 7.0.0-M3 milestone Mar 10, 2025
@sdeleuze sdeleuze added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Mar 10, 2025
sdeleuze pushed a commit to sdeleuze/spring-framework that referenced this pull request Mar 10, 2025
Add a `register(BeanRegistry registry)` method to `BeanRegistry`
to allow registration chaining.

See spring-projectsgh-34557
@sdeleuze sdeleuze closed this in 91d0ebe Mar 10, 2025
@sdeleuze
Copy link
Contributor

Thanks Phil, merged, looks like a useful additional capability.

sdeleuze added a commit to sdeleuze/spring-framework that referenced this pull request Mar 12, 2025
sdeleuze added a commit to sdeleuze/spring-framework that referenced this pull request Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants