-
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
@ServiceConnection is not found when used in an interface implemented by a test class #37671
Comments
Can you elaborate more? I think I didn't get it. Take into account Testcontainers starts containers in random ports and |
Thanks @eddumelendez, I was just writing the same thing! @therealaleko perhaps you could provide a sample application that shows the problem? |
Please check the repo here. Thanks! |
Thanks! So, the ServiceConnection doesn't work when using interfaces I think this line here Line 57 in d310fb6
should change to |
Would it also be possible to add support for inherited interfaces? At the moment the test class has to implement the interface directly, but ideally extending a superclass that implements the interface should work too. |
Refine original fix to also search interfaces on the superclass. Fixes gh-37671
Good spot @andreasevers, I've refined the search algorithm in e01e4f1 |
Wow, thanks Phil! This is great, using it right away! |
Could this latest commit also get backported into 3.1.x perhaps? |
Refine original fix to also search interfaces on the superclass. Fixes gh-37671
Good catch, @andreasevers. Thank you. I've done that in fcb75b6. |
Much appreciated 🙏 |
Thank you! |
Using the new
@ServiceConnection
does not work as I would expect when applied within aninterface
. It starts the container on a random port rather than my spring defined port.@DynamicPropertySource
does work as I expect.The text was updated successfully, but these errors were encountered: