-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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 on a @Bean method does not work in sliced tests #36037
Conversation
Currently, in order to use `@ServiceConnection` in beans along with slice test annotations `@ImportAutoConfiguration(ServiceConnectionAutoConfiguration.class)` should be added to make it work. This commit register `ServiceConnectionAutoConfiguration` in specific slice test annotations. See spring-projectsgh-35252
...rg.springframework.boot.test.autoconfigure.data.couchbase.AutoConfigureDataCouchbase.imports
Outdated
Show resolved
Hide resolved
...ot/test/autoconfigure/data/redis/DataRedisTestWithServiceConnectionBeanIntegrationTests.java
Show resolved
Hide resolved
Thanks for the PR, @eddumelendez. These changes introduce a cycle between
I'm not sure how best to break this cycle. A couple of options:
1 feels the slightly better of these two options. There may also be others that I've overlooked. I'll discuss things with the team. |
Previously, to use `@ServiceConnection` on a `@Bean` method in a sliced test required ServiceConnectionAutoConfiguration to be imported using `@ImportAutoConfiguration`. This commit removes the need for this import by registering ServiceConnectionAutoConfiguration in specific slice test annotations. See gh-36037
Thanks very much for the PR, @eddumelendez. In the end, we went with the second of the two options above. An entry in a |
Currently, in order to use
@ServiceConnection
in beans along withslice test annotations
@ImportAutoConfiguration(ServiceConnectionAutoConfiguration.class)
should be added to make it work. This commit register
ServiceConnectionAutoConfiguration
in specific slice test annotations.See gh-35252