You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am looking at spring-projects/spring-boot#44461 and what my options are to register a reflection hints for the main method that SpringBootContextLoader invokes via reflection.
It is an AotContextLoader but I don't have a way to get the RuntimeHints to register the necessary hint. Looking at the current arrangement, I don't see something that we could implement that gives us the MergedContextConfiguration and RuntimeHints. The closest I found is MergedContextConfigurationRuntimeHints but it's private.
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.
Closesgh-44461
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.
Closesspring-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.
Closesspring-projectsgh-34513
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: