Skip to content

@ImportTestcontainers doesn't work with AOT #42875

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

Open
wilkinsona opened this issue Oct 24, 2024 · 1 comment
Open

@ImportTestcontainers doesn't work with AOT #42875

wilkinsona opened this issue Oct 24, 2024 · 1 comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Milestone

Comments

@wilkinsona
Copy link
Member

For each container field that's found, @ImportTestcontainers creates a TestcontainerFieldBeanDefinition. Such definitions don't work with AOT due to their use of an instance supplier.

@wilkinsona wilkinsona added the type: bug A general bug label Oct 24, 2024
@wilkinsona wilkinsona added this to the 3.2.x milestone Oct 24, 2024
@wilkinsona wilkinsona added the theme: aot An issue related to Ahead-of-time processing label Oct 24, 2024
@philwebb philwebb modified the milestones: 3.2.x, 3.3.x Nov 20, 2024
nosan added a commit to nosan/spring-boot that referenced this issue Mar 2, 2025
Introduce `TestcontainersBeanRegistrationAotProcessor` which
replaces the `InstanceSupplier` of a `Container` with either
direct field access or an equivalent reflection-based approach.

Add `DynamicPropertySourceBeanFactoryInitializationAotProcessor` which
generates methods for each method annotated with `@DynamicPropertySource`.

See spring-projectsgh-42875

Signed-off-by: Dmytro Nosan <[email protected]>
@nosan
Copy link
Contributor

nosan commented Mar 28, 2025

I've prepared a fix for 3.4.x and beyond
3.4.x...nosan:gh-42875

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: aot An issue related to Ahead-of-time processing type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants