Skip to content

Improve documentation for JavaConfig's use of CGLIB for all @Configuration annotated classes [SPR-6885] #11551

Closed
@spring-projects-issues

Description

@spring-projects-issues

Michael Isvy opened SPR-6885 and commented

All @Configuration classes are dynamically subclassed with CGLIB, and the MethodInterceptor that is applied in the overridden versions of all @Bean methods check the container first for any cached (scoped) beans, of course including singletons.

See ConfigurationClassEnhancer and BeanMethodInterceptor for details.

For this reason, @Configuration classes have certain restrictions, such as that they (and their @Bean methods) may not be final; they must have a no-arg constructor, etc.


Referenced from: commits 9e5b129, 6af9177

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions