Add Testcontainers Service Connection support for Cosmos, Blob and Queue
Description
ConnectionDetails and Service Connection support have been added for Cosmos, Storage Blob and Storage Queue.
Currently, Cosmos can be used with Testcontainers only using Gateway Mode. See https://github.com/testcontainers/testcontainers-java/issues/5518
All SDK Contribution checklist:
- [x] The pull request does not introduce [breaking changes]
- [x] CHANGELOG is updated for new features, bug fixes or other significant changes.
- [x] I have read the contribution guidelines.
General Guidelines and Best Practices
- [x] Title of the pull request is clear and informative.
- [x] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.
Testing Guidelines
- [x] Pull request includes test coverage for the included changes.
Fixes spring-projects/spring-boot#40329
Thank you for your contribution @eddumelendez! We will review the pull request and get back to you soon.
API change check
API changes are not detected in this pull request.
FYI: About the test failure, I create a issue in spring-framework repo: https://github.com/spring-projects/spring-framework/issues/33028
And for current PR, I'll fix this test failure by a workaround.
Hi, @saragluna , @Netyyyy . ConnectionDetails is supported since spring-boot:3.1, so java - spring - compatibility - tests with spring-boot:3.0 failed. One solution is claim that next release of Spring Cloud Azure not support spring-boot:3.0. Do you have any other solutions?
Hi, @saragluna
- About the java - spring - compatibility-tests pipeline failure. It's not possible to make pipeline passed without updating the pipeline's configuration. When the pipeline use spring-boot:3.0 to build, and spring-boot:3.0 does not have class like ConnectionDetails. ConnectionDetails is added since spring-boot:3.1.0. So build with spring-boot:3.0will always have error like ClassNotFound.
- According to previous point, How to fix pipeline failure? I see that the pipeline set spring-boot:3.0 as test target version because of this file: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/spring/pipeline/spring-cloud-azure-supported-spring.json. Maybe I should edit this file by creating a PR. But I'm afraid this file will be updated by some job like GitHub actions. Do you have any other options?
- You mentioned that use some method like @ConditionalOnClass to make code compatible with spring-boot:3.0. It's not a good idea because: 3.1. Do like this can NOT make pipeline pass. Maybe user will not have problem, but the pipeline will always failed, because it can NOT find ConnectionDetails when using spring-boot:3.0. 3.2. According to previous point (3.1), without pipeline pass, we are not sure that our code compatible with spring-boot:3.0. 3.3. ConnectionDetails related logic is coupled with current logic of XxxAutoConfiguration. Because ConnectionDetails provided connection information has higher priority than properties. It's not easy to split them. 3.4. Use @ConditionalOnClass to solve this problem requires to make ConnectionDetails to be a inner class inside a class that annotated with @ConditionalOnClass. And all codes may cause ClassNotFound should put into the class annotated with @ConditionalOnClass, do like this will make a mess of logic, and hard to maintain. 3.5. It's highly possible that in future, spring-cloud-azure imported class released since spring-boot:3.x (x > 0). @ConditionalOnClass is not silver bullet to solve this kind of problem.
Hi, @saragluna
I think it's time to prepare the document and sample. Now where should I put the docs and samples for spring-cloud-azure:5.14 which is compatible for spring-boot:3?
Now all tests passed except compatibility test for spring-boot:3.0.
Hi, @saragluna , could you please help to review this PR?
Hi @rujche, thanks for taking care of the PR! Looking forward to see it integrated 😃
Hi, @saragluna . Please help to review this PR.
Closing in favor of https://github.com/Azure/azure-sdk-for-java/pull/41176