Skip to content

Support bean override features with AOT and native image #32933

Closed
@sbrannen

Description

@sbrannen

Overview

Although @MockitoBean and @MockitoSpyBean will not work out-of-the-box within a GraalVM native image due to their dependency on Mockito, the general Bean Override support for tests should ideally work within a native image.

In light of that, we need to ensure that basic usage of @TestBean is supported within a native image, and (if applicable) we will need to document known use cases that are not supported for some reason.

To achieve that, we need to introduce a smoke test application that makes use of @TestBean and verify the expected behavior when the associated tests are run within a native image against Spring Framework 6.2 snapshots or milestones.

We also have to ensure that the necessary runtime hints are registered for the bean override support. For example, we will need tests which verify that reflection hints are registered for the BeanOverrideContextCustomizerFactory, etc.

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

Related Issues

Metadata

Metadata

Assignees

Labels

in: testIssues in the test moduletheme: aotAn issue related to Ahead-of-time processingtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions