spring-projects / spring-projects/spring-framework

Improve org.springframework.beans.factory.BeanRegistry.Spec in order to improve the control over bean creation when programatically registering beans

Open
#37,046 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Hi everyone !

Currently when registering beans programatically with a bean customizer , the customizer is a
java.util.function.Consumer<Spec>
The Spec in a interface ( org.springframework.beans.factory.BeanRegistry.Spec )

It permits to set

  • the scope, as the @org.springframework.context.annotation.Primary annotation would
  • the order, as the @org.springframework.context.annotation.Order annotation would
  • the fallback flag
  • the backgroundInit flag as the @... .Bean.bootstrap() annotation would

It misses some useful methods

  • One for defining the bean qualifier as the @org.springframework.beans.factory.annotation.Qualifier would
  • One for defining the initMethod cf. org.springframework.context.annotation.Bean.initMethod()
  • One for defining the destroyMethod cf. org.springframework.context.annotation.Bean.destroyMethod()
  • One for defining the autowireCandidate flag cf. org.springframework.context.annotation.Bean.autowireCandidate()
  • One for defining aliases cf. @org.springframework.core.annotation.AliasFor

Yours,

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with org.springframework.beans.factory.BeanRegistry.Spec and trace how the Consumer<Spec> is used for programmatic bean registration. Compare the requested qualifier, initMethod, destroyMethod, autowireCandidate, and alias controls with the corresponding annotations and existing Spec options. Done means the requested controls are available and their registration behavior is covered by appropriate tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.