-
Notifications
You must be signed in to change notification settings - Fork 41.1k
@ImportTestcontainers doesn't work with AOT #42891
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
Conversation
2b1535f
to
e9795bb
Compare
91e3273
to
cd63de3
Compare
Unfortunately, handling the bean instance supplier for container fields only addresses |
008de18
to
65e3548
Compare
@philwebb |
7c38b50
to
e6b1c3e
Compare
Sorry for the delay @nosan, I haven't had the chance to look in detail at this one yet. |
@philwebb |
Add TestcontainersBeanRegistrationAotProcessor that replaces InstanceSupplier of Container by either direct field usage or a reflection equivalent. Add DynamicPropertySourceBeanFactoryInitializationAotProcessor that generates methods for each annotated @DynamicPropertySource method See spring-projectsgh-42891 Signed-off-by: Dmytro Nosan <[email protected]>
Introduce `TestcontainersBeanRegistrationAotProcessor` which replaces the `InstanceSupplier` of a `Container` with either direct field access or an equivalent reflection-based approach. Add `DynamicPropertySourceMethodsBeanFactoryInitializationAotProcessor` which generates methods for each method annotated with `@DynamicPropertySource`. Signed-off-by: Dmytro Nosan <[email protected]>
I am closing this PR as it is incompatible with versions 3.4.x and 3.5.x due to changes Although this PR might potentially address issues in 3.3.x, it is no longer applicable to 3.4.x and beyond. |
#42875
Since Bean's InstanceSupplier cannot be used during the AOT process, I added
BeanRegistrationAotProcessor
to replace it.If a container's field is inaccessible, the generated code will be:
If a container's field is accessible, the generated code will be:
An alternative way is
FactoryBean
instead ofInstanceSupplier
.The target branch is 3.2.x