From e4e986478bc8b2a721e8cc17b44c0560e056da53 Mon Sep 17 00:00:00 2001 From: Kushagra Thapar Date: Mon, 24 Jul 2023 17:16:21 -0700 Subject: [PATCH] Updated spring-data-cosmos read me to fix javadoc errors and sb3 versions --- sdk/spring/azure-spring-data-cosmos/README.md | 53 ++++++++++--------- .../repository/ReactiveTeacherRepository.java | 2 +- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/sdk/spring/azure-spring-data-cosmos/README.md b/sdk/spring/azure-spring-data-cosmos/README.md index 86d388b4ce3d..95a0bbc5ff40 100644 --- a/sdk/spring/azure-spring-data-cosmos/README.md +++ b/sdk/spring/azure-spring-data-cosmos/README.md @@ -49,21 +49,22 @@ If you don’t want to use the `spring-boot-starter-parent`, you can still keep Mapping from **Spring Boot** / **Spring Cloud** version to **Azure Spring Data Cosmos** versions -| Spring Boot version | Spring Cloud version | Azure Spring Data Cosmos versions | -|-----------------------|------------------------|---------------------------------| -| 2.7.x | 2021.0.x | 3.23.0 and above | -| 2.6.x | 2021.0.x | 3.15.0 - 3.22.0 | -| 2.5.x | 2020.0.x | 3.8.0 - 3.14.0 | -| 2.4.x | 2020.0.x | 3.5.0 - 3.7.0 | +| Spring Boot version | Spring Cloud version | Azure Spring Data Cosmos versions | +|-----------------------|----------------------|-----------------------------------| +| 3.0.x | 2022.0.x | 5.3.0 and above | +| 2.7.x | 2021.0.x | 3.23.0 and above | +| 2.6.x | 2021.0.x | 3.15.0 - 3.22.0 | +| 2.5.x | 2020.0.x | 3.8.0 - 3.14.0 | +| 2.4.x | 2020.0.x | 3.5.0 - 3.7.0 | ### I'm Using Spring Boot Version X -If you are using **Spring Boot** in your project, you can find related **Azure Spring Data Cosmos** versions from above table. For example: if you are using **Spring Boot** 2.7.x, you should use **Azure Spring Data Cosmos** versions 3.23.0 and above. +If you are using **Spring Boot** in your project, you can find related **Azure Spring Data Cosmos** versions from above table. For example: if you are using **Spring Boot** 3.0.x, you should use **Azure Spring Data Cosmos** versions 5.3.0 and above. ### I'm Using Spring Cloud Version Y -If you are using **Spring Cloud** in your project, you can also find related **Azure Spring Data Cosmos** versions from above table. For example, if you are using **Spring Cloud** 2021.0.x, you should use **Azure Spring Data Cosmos** versions 3.23.0 and above. +If you are using **Spring Cloud** in your project, you can also find related **Azure Spring Data Cosmos** versions from above table. For example, if you are using **Spring Cloud** 2022.0.x, you should use **Azure Spring Data Cosmos** versions 5.3.0 and above. ## Spring Data Version Support -This project supports `spring-data-commons 2.7.x` versions. +This project supports `spring-data-commons 3.0.x` versions. The above setup does not allow you to override individual dependencies using a property as explained above. To achieve the same result, you’d need to add an entry in the dependencyManagement of your project before the `spring-boot-dependencies` entry. For instance, to upgrade to another Spring Data release train you’d add the following to your pom.xml. ```xml @@ -204,25 +205,25 @@ You can customize `DirectConnectionConfig` or `GatewayConnectionConfig` or both ```java readme-sample-AppConfigurationCodeSnippet @Bean -public CosmosClientBuilder getCosmosClientBuilder() { + public CosmosClientBuilder getCosmosClientBuilder() { - DirectConnectionConfig directConnectionConfig = new DirectConnectionConfig(); - GatewayConnectionConfig gatewayConnectionConfig = new GatewayConnectionConfig(); - return new CosmosClientBuilder() - .endpoint(uri) - .directMode(directConnectionConfig, gatewayConnectionConfig); -} + DirectConnectionConfig directConnectionConfig = new DirectConnectionConfig(); + GatewayConnectionConfig gatewayConnectionConfig = new GatewayConnectionConfig(); + return new CosmosClientBuilder() + .endpoint(uri) + .directMode(directConnectionConfig, gatewayConnectionConfig); + } -@Override -public CosmosConfig cosmosConfig() { - return CosmosConfig.builder() - .enableQueryMetrics(queryMetricsEnabled) - .maxDegreeOfParallelism(maxDegreeOfParallelism) - .maxBufferedItemCount(maxBufferedItemCount) - .responseContinuationTokenLimitInKb(responseContinuationTokenLimitInKb) - .responseDiagnosticsProcessor(new ResponseDiagnosticsProcessorImplementation()) - .build(); -} + @Override + public CosmosConfig cosmosConfig() { + return CosmosConfig.builder() + .enableQueryMetrics(queryMetricsEnabled) + .maxDegreeOfParallelism(maxDegreeOfParallelism) + .maxBufferedItemCount(maxBufferedItemCount) + .responseContinuationTokenLimitInKb(responseContinuationTokenLimitInKb) + .responseDiagnosticsProcessor(new ResponseDiagnosticsProcessorImplementation()) + .build(); + } ``` By default, `@EnableCosmosRepositories` will scan the current package for any interfaces that extend one of Spring Data's repository interfaces. diff --git a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveTeacherRepository.java b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveTeacherRepository.java index 797e98d3337e..fb6816bfdd4b 100644 --- a/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveTeacherRepository.java +++ b/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/repository/ReactiveTeacherRepository.java @@ -20,7 +20,7 @@ public interface ReactiveTeacherRepository extends ReactiveCosmosRepository existsByLastNameIsNull(); - @Query(value = "SELECT * FROM a WHERE ARRAY_CONTAINS(@firstNames, a.firstName) ") + @Query(value = "SELECT * FROM a WHERE ARRAY_CONTAINS(@firstNames, a.firstName) order by a.id ") Flux annotatedFindByFirstNames(@Param("firstNames") List firstNames); @Query(value = "SELECT * FROM a WHERE ARRAY_CONTAINS(@firstNames, a.firstName) ")