-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Declaring Containters as beans does not work as expected #35824
Comments
So the error is:
Debugging, |
The section linked to here is for using Testcontainers at development time, when running an application using a test main method as described in the section just above. In your sample, you are writing an integration test, which is a separate use case with different semantics for using So, what you are trying to do in this test is not a supported configuration. I've created #35856 to make the distinction between integration tests and development-time testing more clear in the documentation. |
Thanks for this clarification, does that mean you cannot use @DynamicPropertySource when using development time and a test main method? and if you have a container which doesn't support ServiceConnection, you are out of luck |
@jbeaken The Spring Boot documentation has as section that covers dynamic properties with Testcontainers at development time: https://docs.spring.io/spring-boot/docs/3.1.0/reference/htmlsingle/#features.testing.testcontainers.at-development-time.dynamic-properties |
This comment was marked as duplicate.
This comment was marked as duplicate.
I really did not understand the |
I followed the official guide to declare test containers as beans, the general method is working well.
But when adding the fallback method as described in https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.testing.testcontainers.at-development-time.dynamic-properties
It did not work as expected.
Reproduce example: https://github.com/hantsy/spring6-sandbox/blob/master/boot-data-r2dbc/src/test/java/com/example/demo/TestcontainersBeanExampleTests.java
The text was updated successfully, but these errors were encountered: