Overview

As alluded to in #32925, it's possible to run AOT tests for bean override support in the Spring TestContext Framework (TCF) manually via the endToEndTestsForEntireSpringTestModule() and endToEndTestsForSelectedTestClasses() methods in AotIntegrationTests; however, that must be performed manually.

In order to ensure that tests using the new bean override support (@TestBean, @MockitoBean, and @MockitoSpyBean) run correctly in AOT mode, we need to introduce dedicated tests that are run with every build.

As a bare minimum, AotIntegrationTests.endToEndTests() must be modified to include test classes that utilize the basic features of @TestBean, @MockitoBean, and @MockitoSpyBean.

The test classes included could be existing ones from the org.springframework.test.context.bean.override.convention and org.springframework.test.context.bean.override.mockito packages, or we could create new, simplified test classes in org.springframework.test.context.aot.samples.bean.override.

Related Issues

  • https://github.com/spring-projects/spring-boot/issues/32195
  • 29122

  • 32925

Comment From: snicoll

We now have three issues for basically the same thing, that is asses how much of the bean overriding support are we going to be able to support with AOT. As part as assessing this, we will obviously write any missing tests.