-
Notifications
You must be signed in to change notification settings - Fork 38.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
@Resource
dependency injection fails with AOT/native
#29614
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
@Resource
dependency injection fails with AOT/native
Confirmed, the required reflection hints are missing when using |
|
This is doable but more involved than expected, so I prefer to focus on the other issues for |
As we try to empty |
That should cover support for the application. However, I think we will need something like @jhoeller, thoughts? |
@Resource
dependency injection fails with AOT/native@Resource
and @EJB
dependency injection fails with AOT/native
While running tests such as I've updated the title of this issue to reflect that. |
@Resource
and @EJB
dependency injection fails with AOT/native@Resource
dependency injection fails with AOT/native
Let's keep the scope of the issue as it is now please. While technically those two are related, I don't see a reason to spend efforts to suport |
This commit adds ahead of time support for @resource on fields and methods. Lookup elements are discovered and code is generated to replace that introspection at runtime. Closes spring-projectsgh-29614
Affects: Spring 6.0.2 / SpringBoot 3.0.0 / GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
Injection of spring beans fails when using
@Resource
and native image.When using
@Autowired
the dependency injections works as expected.example project:
https://github.com/javamichi18/graalDependencyTest
e.g.
Run app:
graalDependencyTest % ./target/gdt
Invocation of REST endpoint ...
... triggers NullPointerException when using
@Resource
, but not when using@Autowired.
environment:
java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
Apple Silicon M1 max
I am using the maven build profile native2, because using
mvn spring-boot:build-image -Pnative
leads to a stuck build / running endlessness (> 45 minutes).
The text was updated successfully, but these errors were encountered: