-
Notifications
You must be signed in to change notification settings - Fork 41k
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
TestcontainersLifecycleBeanPostProcessor does not work correctly with scoped beans #35786
Comments
@RestartScope
@RestartScope
Hello @philwebb, i would like to fix this. Please assign it to me. |
Thanks @nedimAT, I've assigned the issue to you. I've no idea if it's an easy or difficult fix so feel free to comment here if you don't get anywhere. |
Hello @eddumelendez, for me the rabbitmq example works as expected. Removing the |
I have another example. See https://github.com/eddumelendez/spring-boot-sqs-testcontainers-reusable-mode In summary, @RestartScope works with existing supported ServiceConnections but not when used along with DynamicProperties. Not close at the computer right now but in those scenarios is like Testcontainers is ignored and not picked up. You should be able to reproduce with this last example. If needed I can attach logs later. |
Thanks, with that example i can reproduce it. I will start looking into it. |
Hello @philwebb could you provide me with some hint where i should start. What i know so far is, that |
I did another check and wonder if just changing the following lines Lines 84 to 85 in b8c4fb6
to beanNames.addAll(List.of(this.beanFactory.getBeanNamesForType(ContainerState.class, true, false)));
beanNames.addAll(List.of(this.beanFactory.getBeanNamesForType(Startable.class, true, false))); due to the scope is not |
@RestartScope
Hi, @eddumelendez, @philwebb But when add Is it reasonable to add a tip to the documentation? |
Thanks for the hint @eddumelendez. Hopefully fixed in the next snapshot. |
Thanks @philwebb ! It's working :) |
I've been following this ticket since before it got renamed and with the latest 3.3.2-SNAPSHOT The combination of |
@shawnweeks Does the discussion in #35200 and the documentation changes made in this related commit help with your use case? |
@scottfrederick They don't appear to. This issue was originally about |
I’ve been playing around with several examples using Spring Boot Testcontainers at Development time and last night I noticed those are not working as expected with
@RestartScope
. IIRC this example used to work in the past, download the image, start the container and so on. I also tried something similar to what’s mentioned in the docs but the image is not downloaded at all in this example if@ServiceConnection
is removed. It works as expected without@RestartScope
The text was updated successfully, but these errors were encountered: