Skip to content

InstantiationAwareBeanPostProcessor.postProcessBeforeInstantiation called with wrong beanClass for bean declared on JavaConfig [SPR-12142] #16756

@spring-projects-issues

Description

@spring-projects-issues

Arrault Fabien opened SPR-12142 and commented

When a bean is created with JavaConfig with a @Bean method WITH the static modifier (there is another issue without the static modifier : #16754), the method postProcessBeforeInstantiation of InstantiationAwareBeanPostProcessor beans is called with the wrong beanClass parameter :
This parameter is populated with the beanClass of the @Configuration class containing the @Bean method instead of the target beanClass of the bean being about to be created.

See testcase attached

This method is correctly called when the bean is declared in an XML File.

This sometimes causes troubles in edge cases when using of LazyInitTargetSourceCreator on JavaConfig (see #15140)


Affects: 4.0.6

Attachments:

Issue Links:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions