Skip to content

Introduce AotContextLoader SPI in the TestContext framework #28906

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

Closed
sbrannen opened this issue Aug 1, 2022 · 1 comment
Closed

Introduce AotContextLoader SPI in the TestContext framework #28906

sbrannen opened this issue Aug 1, 2022 · 1 comment
Assignees
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

@sbrannen
Copy link
Member

sbrannen commented Aug 1, 2022

Overview

In order to support AOT build-time processing within the Spring TestContext Framework (TCF), we need a way to signal to SmartContextLoader implementations that they should load the test's ApplicationContext without refreshing it or registering a JVM shutdown hook.

In addition, we also need a way for a SmartContextLoader to participate in context loading during AOT run-time execution.

Related Issues

@sbrannen sbrannen added in: test Issues in the test module type: enhancement A general enhancement theme: aot An issue related to Ahead-of-time processing labels Aug 1, 2022
@sbrannen sbrannen added this to the 6.0.0-M6 milestone Aug 1, 2022
@sbrannen sbrannen self-assigned this Aug 1, 2022
@sbrannen sbrannen changed the title Introduce configurable refresh loadContext() variant in SmartContextLoader Introduce "no refresh" SmartContextLoader.loadContext() variant Aug 2, 2022
@sbrannen sbrannen changed the title Introduce "no refresh" SmartContextLoader.loadContext() variant Introduce configurable refresh support in SmartContextLoader SPI Aug 3, 2022
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Aug 3, 2022
This commit revises 903e9f2 based on feedback from the Spring Boot
team.

- The original loadContext(MergedContextConfiguration) method is no
  longer deprecated.

- loadContext(MergedContextConfiguration, boolean) has been replaced by
  loadContextForAotProcessing(MergedContextConfiguration) which is
  implemented as a `default` method that throws an
  UnsupportedOperationException.

- Affected code has been refactored to adjust to these changes.

See spring-projectsgh-28906
sbrannen added a commit that referenced this issue Aug 4, 2022
@sbrannen
Copy link
Member Author

Reopening to introduce a dedicated AotContextLoader extension of SmartContextLoader instead of modifying the existing contract for SmartContextLoader.

@sbrannen sbrannen reopened this Aug 21, 2022
@sbrannen sbrannen changed the title Introduce configurable refresh support in SmartContextLoader SPI Introduce AotContextLoader SPI in the TestContext framework Aug 21, 2022
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Aug 22, 2022
This commit introduces a dedicated AotContextLoader extension of
SmartContextLoader and reverts the recent changes to the existing
contract for SmartContextLoader. This allows existing
SmartContextLoader implementations to continue working unaffected by
AOT support unless they opt into AOT support by explicitly implementing
the new AotContextLoader contract.

In addition, existing SmartContextLoader implementations in the
spring-test module have been modified to implement AotContextLoader
instead of SmartContextLoader. This allows the core framework to
provide built-in AOT support in the TestContext framework, and it also
allows third-party extensions to built-in SmartContextLoaders to
participate in AOT processing and run-time support transparently (or at
least as transparent as possible).

Closes spring-projectsgh-28906
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Aug 23, 2022
This commit introduces a dedicated AotContextLoader extension of
SmartContextLoader and reverts the recent changes to the existing
contract for SmartContextLoader. This allows existing
SmartContextLoader implementations to continue working unaffected by
AOT support unless they opt into AOT support by explicitly implementing
the new AotContextLoader contract.

In addition, existing SmartContextLoader implementations in the
spring-test module have been modified to implement AotContextLoader
instead of SmartContextLoader. This allows the core framework to
provide built-in AOT support in the TestContext framework, and it also
allows third-party extensions to built-in SmartContextLoaders to
participate in AOT processing and run-time support transparently (or at
least as transparent as possible).

Closes spring-projectsgh-28906
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
Projects
None yet
Development

No branches or pull requests

1 participant