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

Support for InjectionPoint in bean factory methods when using AOT #30401

Closed
f-cramer opened this issue Apr 30, 2023 · 1 comment
Closed

Support for InjectionPoint in bean factory methods when using AOT #30401

f-cramer opened this issue Apr 30, 2023 · 1 comment
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@f-cramer
Copy link

f-cramer commented Apr 30, 2023

Affects: Spring Framework 6.0.8

When using AOT (via gradle bootBuildImage task) any bean factory method that has a parameter of type InjectionPoint results in an UnsatisfiedDependencyException thrown in BeanInstanceSupplier.java:343.

It should be possible to inject such an instance because it is also created when creating the exception.

For an MCVE see here.

When started with ./gradlew :bootRun it successfully executes and logs running logging runner.

When starting the image that is produced with ./gradlew :bootBuildImage it fails with the following message


APPLICATION FAILED TO START


Description:

Parameter 0 of method logger in com.example.injectionpoint.LoggerConfiguration required a bean of type 'org.springframework.beans.factory.InjectionPoint' that could not be found.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 30, 2023
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing labels Apr 30, 2023
@sbrannen sbrannen changed the title Support for InjectionPoint in bean factory methods when using AOT Support for InjectionPoint in bean factory methods when using AOT Apr 30, 2023
@snicoll snicoll added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 30, 2023
@snicoll snicoll self-assigned this Apr 30, 2023
@snicoll snicoll added this to the 6.0.x milestone Apr 30, 2023
@snicoll
Copy link
Member

snicoll commented Apr 30, 2023

Good catch @f-cramer and thanks for the reproducer.

@snicoll snicoll modified the milestones: 6.0.x, 6.0.9 May 9, 2023
snicoll added a commit to snicoll/spring-framework that referenced this issue May 9, 2023
This commit reviews BeanInstanceSupplier to reuse more code from
ConstructorResolver. Previously, the autowired argument resolution was
partially duplicated and this commit introduces a new common path via
RegisteredBean#resolveAutowiredArgument.

Closes spring-projectsgh-30401
@snicoll snicoll closed this as completed in c1f6d71 May 9, 2023
izeye added a commit to izeye/spring-framework that referenced this issue Jun 7, 2023
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) theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants