Skip to content

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

Description

@Guillaume-Lacombe

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions