Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 27 additions & 26 deletions sdk/spring/azure-spring-data-cosmos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface ReactiveTeacherRepository extends ReactiveCosmosRepository<Reac

Mono<Boolean> 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 ")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changing the query? should we add another test for the order by?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already another one for order by :)
Changing this one so that we can match the results 100% of the time always, currently they come unordered and can come in any order without any guarantee, causing the test to be flaky.

Flux<ReactiveTeacher> annotatedFindByFirstNames(@Param("firstNames") List<String> firstNames);

@Query(value = "SELECT * FROM a WHERE ARRAY_CONTAINS(@firstNames, a.firstName) ")
Expand Down