-
Notifications
You must be signed in to change notification settings - Fork 41.1k
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
Using @ServiceConnection on a Container @Bean method does not work with AOT-processed tests #42851
Comments
This is similar to #35663, although that issue was using |
@wilkinsona it works with following configuration: @SpringBootTest
@Testcontainers
class DemoApplicationTests {
@Container
@ServiceConnection
static MongoDBContainer mongoDbContainer = new MongoDBContainer(DockerImageName.parse("mongo:latest"));
@Test
void contextLoads() {
}
} |
That's good to know, @wyhasany. Thank you. We'll see what we can do for the |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Undoing the fix for #35663 results in the following failure during AOT processing:
This is caused by Line 105 in 8ff3084
Unlike #35663, where there is a test context customizer that will register the beans when the tests are being run, skipping these beans results in them not being defined at all. It looks like we need to find a way to register them during AOT processing without using an instance supplier. |
Spring Boot application fails to run the
nativeTest
task with Testcontainers.I generated a simple project using start.spring.io:
On the first run, it fails due to a reflection issue:
I solved this issue by adding a
reflect.json
file insrc/test/resources/META-INF/native-image/
with the following content::However, I'm confused because Testcontainers seems to be supported by GraalVM as indicated here: https://www.graalvm.org/native-image/libraries-and-frameworks/
With that configuration, I encountered another issue that I'm unsure how to resolve:
It looks like the task
aotTestClasses
doesn't add anyMongoConnectionDetails
to the application context.Here is the zipped project for reference: demo.zip
Environment Details
I'm using the following version of GraalVM:
The text was updated successfully, but these errors were encountered: