This commit is contained in:
azure-sdk 2024-03-28 02:38:12 +00:00
Родитель bdac4873bb
Коммит 6205d87b46
2 изменённых файлов: 28 добавлений и 14 удалений

Просмотреть файл

@ -1,12 +1,12 @@
---
title: Azure Spring Data Cosmos client library for Java
keywords: Azure, java, SDK, API, azure-spring-data-cosmos, spring
ms.date: 03/01/2024
ms.date: 03/28/2024
ms.topic: reference
ms.devlang: java
ms.service: spring
---
# Azure Spring Data Cosmos client library for Java - version 5.10.0
# Azure Spring Data Cosmos client library for Java - version 3.44.0
**Azure Spring Data Cosmos** provides Spring Data support for Azure Cosmos DB using the [SQL API][sql_api_query], based on Spring Data framework.
@ -67,13 +67,13 @@ Mapping from **Spring Boot** / **Spring Cloud** version to **Azure Spring Data C
| 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** 3.0.x, you should use **Azure Spring Data Cosmos** versions 5.3.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** 2.7.x, you should use **Azure Spring Data Cosmos** versions 3.23.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** 2022.0.x, you should use **Azure Spring Data Cosmos** versions 5.3.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** 2021.0.x, you should use **Azure Spring Data Cosmos** versions 3.23.0 and above.
## Spring Data Version Support
This project supports `spring-data-commons 3.0.x` versions.
This project supports `spring-data-commons 2.7.x` versions.
The above setup does not allow you to override individual dependencies using a property as explained above. To achieve the same result, youd 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 youd add the following to your pom.xml.
```xml
@ -109,7 +109,7 @@ If you are using Maven, add the following dependency.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-spring-data-cosmos</artifactId>
<version>5.10.0</version>
<version>3.44.0</version>
</dependency>
```
[//]: # ({x-version-update-end})
@ -306,7 +306,7 @@ public CosmosConfig cosmosConfig() {
- Containers will be created automatically unless you don't want them to. Set `autoCreateContainer` to false in `@Container` annotation to disable auto creation of containers.
- Note: By default request units assigned to newly created containers is 400. Specify different ru value to customize request units for the container created by the SDK (minimum RU value is 400).
- Note: If you are using provisioned throughput, you can optionally specify different ru values to customize request units for the container created by the SDK. The minimum ru should be 400
```java readme-sample-User
@Container(containerName = "myContainer", ru = "400")
public class User {
@ -719,7 +719,7 @@ azure.cosmos.secondary.database=your-secondary-cosmosDb-dbName
azure.cosmos.secondary.populateQueryMetrics=if-populate-query-metrics
```
- The [Entity](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos#define-an-entity) and [Repository](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos#create-repositories) definition is similar as above. You can put different database entities into different packages.
- The [Entity](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos#define-an-entity) and [Repository](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos#create-repositories) definition is similar as above. You can put different database entities into different packages.
- The `@EnableReactiveCosmosRepositories` or `@EnableCosmosRepositories` support user-define the cosmos template, use `reactiveCosmosTemplateRef` or `cosmosTemplateRef` to config the name of the `ReactiveCosmosTemplate` or `CosmosTemplate` bean to be used with the repositories detected.
- If you have multiple cosmos database accounts, you can define multiple `CosmosAsyncClient`. If the single cosmos account has multiple databases, you can use the same `CosmosAsyncClient` to initialize the cosmos template.
@ -777,7 +777,7 @@ public class SecondaryDatasourceConfiguration {
public CosmosAsyncClient getCosmosAsyncClient(@Qualifier("secondary") CosmosProperties secondaryProperties) {
return CosmosFactory.createCosmosAsyncClient(new CosmosClientBuilder()
.key(secondaryProperties.getKey())
.endpoint(secondaryProperties.getUri()));
.endpoint(secondaryProperties.getUri());
}
@Bean("secondaryCosmosConfig")
@ -815,7 +815,7 @@ public class SecondaryDatasourceConfiguration {
public CosmosAsyncClient getCosmosAsyncClient(@Qualifier("secondary") CosmosProperties secondaryProperties) {
return CosmosFactory.createCosmosAsyncClient(new CosmosClientBuilder()
.key(secondaryProperties.getKey())
.endpoint(secondaryProperties.getUri()));
.endpoint(secondaryProperties.getUri());
}
@Bean("secondaryCosmosConfig")
@ -913,7 +913,7 @@ azure.cosmos.database=your-cosmosDb-dbName
azure.cosmos.populate-query-metrics=if-populate-query-metrics
```
- The [Entity](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos#define-an-entity) and [Repository](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos#create-repositories) definition is similar as above. You can put different database entities into different packages.
- The [Entity](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos#define-an-entity) and [Repository](https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos#create-repositories) definition is similar as above. You can put different database entities into different packages.
- You can use `EnableReactiveCosmosRepositories` with different `reactiveCosmosTemplateRef` to define multiple databases in single cosmos account.
```java
@ -1050,7 +1050,7 @@ public class MultiTenantDBCosmosFactory extends CosmosFactory {
## Beta version package
Beta version built from `main` branch are available, you can refer to the [instruction](https://github.com/Azure/azure-sdk-for-java/blob/azure-spring-data-cosmos_5.10.0/CONTRIBUTING.md#nightly-package-builds) to use beta version packages.
Beta version built from `main` branch are available, you can refer to the [instruction](https://github.com/Azure/azure-sdk-for-java/blob/azure-spring-data-cosmos_3.44.0/CONTRIBUTING.md#nightly-package-builds) to use beta version packages.
## Troubleshooting
@ -1121,7 +1121,7 @@ or contact [opencode@microsoft.com][coc_contact] with any additional questions o
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
[coc_contact]: mailto:opencode@microsoft.com
[azure_subscription]: https://azure.microsoft.com/free/
[samples]: https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos
[samples]: https://github.com/Azure/azure-sdk-for-java/tree/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos/src/samples/java/com/azure/spring/data/cosmos
[sample-for-multi-database]: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_v4.3.0/cosmos/azure-spring-data-cosmos/cosmos-multi-database-multi-account
[sample-for-multi-database-single-account]: https://github.com/Azure-Samples/azure-spring-boot-samples/tree/spring-cloud-azure_v4.3.0/cosmos/azure-spring-data-cosmos/cosmos-multi-database-single-account
[sql_api_query]: /azure/cosmos-db/sql-api-sql-query
@ -1129,7 +1129,7 @@ or contact [opencode@microsoft.com][coc_contact] with any additional questions o
[local_emulator_export_ssl_certificates]: /azure/cosmos-db/local-emulator-export-ssl-certificates
[spring_data_commons_id_annotation]: https://github.com/spring-projects/spring-data-commons/blob/main/src/main/java/org/springframework/data/annotation/Id.java
[azure_cosmos_db_partition]: /azure/cosmos-db/partition-data
[address_repository_it_test]: https://github.com/Azure/azure-sdk-for-java/blob/azure-spring-data-cosmos_5.10.0/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/AddressRepositoryIT.java
[address_repository_it_test]: https://github.com/Azure/azure-sdk-for-java/blob/azure-spring-data-cosmos_3.44.0/sdk/spring/azure-spring-data-cosmos/src/test/java/com/azure/spring/data/cosmos/repository/integration/AddressRepositoryIT.java
[azure_spring_data_cosmos_docs]: /azure/cosmos-db/sql-api-sdk-java-spring-v3
[spring_data_custom_query]: https://docs.spring.io/spring-data/commons/docs/current/reference/html/#repositories.query-methods.details
[sql_queries_in_cosmos]: /azure/cosmos-db/tutorial-query-sql-api

Просмотреть файл

@ -0,0 +1,14 @@
{
"Name": "azure-spring-data-cosmos",
"Version": "3.44.0",
"DevVersion": null,
"DirectoryPath": "sdk/spring/azure-spring-data-cosmos",
"ServiceDirectory": "spring",
"ReadMePath": "sdk/spring/azure-spring-data-cosmos/README.md",
"ChangeLogPath": "sdk/spring/azure-spring-data-cosmos/CHANGELOG.md",
"Group": "com.azure",
"SdkType": "spring",
"IsNewSdk": true,
"ArtifactName": "azure-spring-data-cosmos",
"ReleaseStatus": "2024-03-28"
}