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
{{ message }}
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
TestExecutionListeners are not loaded in native image #1217
At some point during the migration to using Spring AOT for Spring TestContext Framework (TCF) support when executing tests within a native image, the TestExecutionListener implementations stopped being loaded.
Consequently, none of the native image tests for the sample applications actually loads an ApplicationContext. The reason is that a test ApplicationContext is only loaded if a registered TestExecutionListener invokes TestContext#getApplicationContext().
Analysis
TestExecutionListeners are configured via spring.factories and loaded reflectively.
The reason TestExecutionListener implementations are no longer loaded is that the DefaultFactoriesCodeContributor gets used for processing TestExecutionListener types in spring.factories, and that results in support being added to StaticSpringFactories for loading the TestExecutionListeners via SpringFactoriesLoader.loadFactories(). However, the TCF instead uses SpringFactoriesLoader.loadFactoryNames() and instantiates the TestExecutionListeners on its own via reflection.
Deliverables
Introduce a new FactoriesCodeContributor that handles TestExecutionListener implementations and generates the appropriate native image reflection configuration.
Activity
Only register default constructor for TELs for reflection in native i…
Add unit tests for TestExecutionListenerFactoriesCodeContributor
Ensure TestExecutionListeners are loaded in native image