-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Supply RuntimeHints
to an AotContextLoader
#34513
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
Milestone
Comments
snicoll
added a commit
to spring-projects/spring-boot
that referenced
this issue
Feb 28, 2025
This commit makes sure to register the necessary hints to invoke the main method of any bean available in the context. This is necessary for tests that use the UseMainMethod feature. This generates more hints than strictly necessary as there isn't a way to contribute hints based on a ContextLoader, see spring-projects/spring-framework#34513 for more details. Closes gh-44461
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Feb 28, 2025
This commit introduces a new loadContextForAotProcessing(...) variant in AotContextLoader which accepts a RuntimeHints argument. This new method is an interface default method which delegates to the existing loadContextForAotProcessing(MergedContextConfiguration) variant. Note, however, that the framework now only invokes the new loadContextForAotProcessing(...) variant within TestContextAotGenerator. Closes spring-projectsgh-34513
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Feb 28, 2025
This commit introduces a new loadContextForAotProcessing(...) variant in AotContextLoader which accepts a RuntimeHints argument. This new method is an interface default method which delegates to the existing loadContextForAotProcessing(MergedContextConfiguration) variant for backward compatibility. In addition, the original loadContextForAotProcessing(...) variant is now deprecated and has been converted to an interface default method which throws an UnsupportedOperationException. Note, however, that the framework now only invokes the new loadContextForAotProcessing(...) variant within TestContextAotGenerator. Closes spring-projectsgh-34513
RuntimeHints
to an AotContextLoader
sbrannen
added a commit
that referenced
this issue
Mar 3, 2025
This commit introduces a new loadContextForAotProcessing(...) variant in AotContextLoader which accepts a RuntimeHints argument. This new method is an interface default method which delegates to the existing loadContextForAotProcessing(MergedContextConfiguration) variant for backward compatibility. In addition, the original loadContextForAotProcessing(...) variant is now deprecated and has been converted to an interface default method which throws an UnsupportedOperationException. Note, however, that the framework now only invokes the new loadContextForAotProcessing(...) variant within TestContextAotGenerator. Closes gh-34513
snicoll
added a commit
to spring-projects/spring-boot
that referenced
this issue
Mar 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: enhancement
A general enhancement
I am looking at spring-projects/spring-boot#44461 and what my options are to register a reflection hints for the
main
method thatSpringBootContextLoader
invokes via reflection.It is an
AotContextLoader
but I don't have a way to get theRuntimeHints
to register the necessary hint. Looking at the current arrangement, I don't see something that we could implement that gives us theMergedContextConfiguration
andRuntimeHints
. The closest I found isMergedContextConfigurationRuntimeHints
but it's private.Have I missed something? https://github.com/spring-projects/spring-boot/blob/93648792b14301264c7fdbb4ea343b9092a0d7ed/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java#L128 is where I'd need some way to get the runtime hints.
The text was updated successfully, but these errors were encountered: