用于 Core (SQL) API 的 Spring Data Azure Cosmos DB v2:发行说明和资源Spring Data Azure Cosmos DB v2 for Core (SQL) API: release notes and resources

通过用于 Core (SQL) 的 Spring Data Azure Cosmos DB v2,开发人员可以在 Spring 应用程序中使用 Azure Cosmos DB。The Spring Data Azure Cosmos DB v2 for Core (SQL) allows developers to utilize Azure Cosmos DB in Spring applications. Spring Data Azure Cosmos DB 公开 Spring Data 接口,以便操作数据库和集合、使用文档和发出查询。Spring Data Azure Cosmos DB exposes the Spring Data interface for manipulating databases and collections, working with documents, and issuing queries. 同一 Maven 项目中同时支持 Sync 和 Async (Reactive) API。Both Sync and Async (Reactive) APIs are supported in the same Maven artifact.

Spring Framework 是一种简化 Java 应用程序开发的编程和配置模型。The Spring framework is a programming and configuration model which streamlines Java application development. 为引用组织的网站,Spring 使用依赖项注入来简化应用程序的“管道”。To quote the organization's website, Spring streamlines the "plumbing" of applications using dependency injection. 由于生成和测试应用程序变得更加简单,因此许多开发人员喜欢 Spring。Many developers like Spring because building and testing applications becomes more straightforward. Spring Boot 重视 Web 应用程序和微服务的开发,扩展了这种处理管道的理念。Spring Boot extends this idea of handling the plumbing with an eye towards web application and microservices development. Spring Data 是一种编程模型,用于从 Spring 或 Spring Boot 应用程序的上下文中访问数据存储(如 Azure Cosmos DB)。Spring Data is a programming model for accessing datastores such as Azure Cosmos DB from the context of a Spring or Spring Boot application.

可在 Azure Spring Cloud 应用程序中使用 Spring Data Azure Cosmos DB。You can use Spring Data Azure Cosmos DB in your Azure Spring Cloud applications.

重要

这些发行说明适用于 Spring Data Azure Cosmos DB v2。These release notes are for v2 of Spring Data Azure Cosmos DB. 可以在此处找到 v3 发行说明。You can find v3 release notes here.

Spring Data Azure Cosmos DB 仅支持 SQL API。Spring Data Azure Cosmos DB only supports SQL API.

以下指南支持其他 Azure Cosmos DB API 上的 Spring Data:The following guides support Spring Data on other Azure Cosmos DB APIs:

希望快速开始?Want to get going fast?

  1. 安装最低支持的 Java 运行时版本,JDK 8,以便可以使用 SDK。Install the minimum supported Java runtime, JDK 8 so you can use the SDK.
  2. 使用初学者套件创建 Spring Data Azure Cosmos DB 应用 - 非常简单Create a Spring Data Azure Cosmos DB app using the starter - it's easy!
  3. 通过 Spring Data Azure Cosmos DB 开发人员指南了解基本的 Azure Cosmos DB 请求。Work through the Spring Data Azure Cosmos DB Developers Guide which walks through basic Azure Cosmos DB requests.

可通过 Spring Initializr 快速启动 Spring Boot Starter 应用!You can spin up Spring Boot Starter apps fast with Spring Initializr!

帮助性内容Helpful content

ContentContent 链接Link
SDK 下载SDK download MavenMaven
API 文档API documentation Spring Data Azure Cosmos DB 参考文档Spring Data Azure Cosmos DB reference documentation
参与 SDKContribute to SDK GitHub 上的 Spring Data Azure Cosmos DB 存储库Spring Data Azure Cosmos DB Repo on GitHub
Spring Boot StarterSpring Boot starter 适用于 Java 的 Azure Cosmos DB Spring Boot Starter 客户端库Azure Cosmos DB Spring Boot Starter client library for Java
用于 Azure Cosmos DB 的 Spring TODO 应用示例Spring TODO app sample with Azure Cosmos DB 应用服务 Linux 中的端到端 Java 体验(第 2 部分)End-to-end Java Experience in App Service Linux (Part 2)
开发人员指南Developers guide Spring Data Azure Cosmos DB 开发人员指南Spring Data Azure Cosmos DB Developers Guide
Starter 使用指南Guide to using starter 如何将 Spring Boot Starter 与 Azure Cosmos DB SQL API 配合使用How to use the Spring Boot Starter with the Azure Cosmos DB SQL API
适用于 Azure Spring Boot Starter Cosmos DB 的 GitHub 存储库GitHub repo for Azure Spring Boot Starter Cosmos DB
应用服务示例Sample with App Services 如何将 Spring 和 Cosmos DB 与 Linux 上的应用服务配合使用How to use Spring and Cosmos DB with App Service on Linux
TODO 应用示例TODO app sample

版本历史记录Release history

2.3.0 (2020-05-21)2.3.0 (2020-05-21)

新增功能New features

  • 将 Spring Boot 版本更新为 2.3.0Update spring boot version to 2.3.0

关键 Bug 修复Key bug fixes

2.2.5 (2020-05-19)2.2.5 (2020-05-19)

新增功能New features

  • 已将 Azure Cosmos DB 版本更新为 v3.7.3Updated Azure Cosmos DB version to v3.7.3

关键 Bug 修复Key bug fixes

  • 包含来自 Cosmos SDK v3.7.3 的内存泄漏修复和 netty 版本升级Contains memory leak fixes and netty version upgrades from Cosmos SDK v3.7.3

2.2.4 (2020-04-06)2.2.4 (2020-04-06)

新增功能New features

关键 Bug 修复Key bug fixes

  • 修复了 CosmosDbConfig 中要考虑的 allowTelemetry 标志Fixed allowTelemetry flag to take into account from CosmosDbConfig
  • 修复了容器上的 TTL 属性Fixed TTL property on container

2.2.3 (2020-02-25)2.2.3 (2020-02-25)

新增功能New features

  • 添加了按分区键 API 的新 findAllAdded new findAll by partition key API
  • 已将 azure-cosmos 版本更新为 3.7.0Updated azure-cosmos version to 3.7.0

关键 Bug 修复Key bug fixes

  • 修复了 collectionName -> containerNameFixed collectionName -> containerName
  • 修复了 entityClass & domainClass -> domainTypeFixed entityClass & domainClass -> domainType
  • 修复了以下问题:返回存储库保存的实体集合而不是输入实体Fixed "Return entity collection saved by repository instead of input entity"

2.1.10 (2020-02-25)2.1.10 (2020-02-25)

新增功能New features

关键 Bug 修复Key bug fixes

  • 向后移植修复了以下问题:返回存储库保存的实体集合而不是输入实体Backported fix for "Return entity collection saved by repository instead of input entity"

2.2.2 (2020-01-15)2.2.2 (2020-01-15)

新增功能New features

  • 已将 azure-cosmos 版本更新为 v3.6.0Updated azure-cosmos version to v3.6.0

关键 Bug 修复Key bug fixes

2.2.1 (2019-12-31)2.2.1 (2019-12-31)

新增功能New features

  • 已将 Cosmos DB SDK 版本更新为 3.5.0Updated Cosmos DB SDK version to 3.5.0
  • 添加了注释字段以启用/禁用自动创建集合Added annotation field to enable/disable auto create collection
  • 公开了通过 CosmosDBAccessException 的 CosmosClientException 以便更好地处理异常Better Exception handling, exposed CosmosClientException through CosmosDBAccessException
  • 公开了通过 ResponseDiagnostics 的 requestCharge 和 activityIdExposed requestCharge and activityId through ResponseDiagnostics

关键 Bug 修复Key bug fixes

  • SDK 3.5.0 更新修复了以下问题:Cosmos DB HTTP 响应标头大于 8192 字节时出现异常;ConsistencyPolicy.defaultConsistencyLevel() 在有限过期和前缀一致性上失败SDK 3.5.0 update fixes "Exception when Cosmos DB HTTP response header is larger than 8192 bytes", "ConsistencyPolicy.defaultConsistencyLevel() fails on Bounded Staleness and Consistent Prefix"
  • 修复了 findById API 行为:在未找到时返回空值,而不是引发异常Fixed findById APIs behavior, return empty on not found, instead of throwing exception
  • 修复了以下 bug:使用 CosmosPageRequest 时下一页未应用排序Fixed a bug where sorting was not applied on next page when using CosmosPageRequest

2.1.9 (2019-12-26)2.1.9 (2019-12-26)

新增功能New features

  • 添加了注释字段以启用/禁用自动创建集合Added annotation field to enable/disable auto create collection

关键 Bug 修复Key bug fixes

  • 修复了 findById API 行为:在未找到时返回空值,而不是引发异常Fixed findById APIs behavior, return empty on not found, instead of throwing exception

2.2.0 (2019-10-21)2.2.0 (2019-10-21)

新增功能New features

  • 完成 Reactive Cosmos Repository 支持Complete Reactive Cosmos Repository Support
  • Cosmos DB 请求诊断字符串和查询指标支持Cosmos DB Request Diagnostics String and Query Metrics Support
  • Cosmos DB SDK 版本更新为 3.3.1Cosmos DB SDK version update to 3.3.1
  • Spring Framework 版本升级为 5.2.0.RELEASESpring Framework version upgrade to 5.2.0.RELEASE
  • Spring Data Commons 版本升级为 2.2.0.RELEASESpring Data Commons version upgrade to 2.2.0.RELEASE
  • 添加了 findByIdAndPartitionKey、deleteByIdAndPartitionKey APIAdded findByIdAndPartitionKey, deleteByIdAndPartitionKey APIs
  • 从 azure-doumentdb 中删除了依赖项Removed dependency from azure-doumentdb
  • 将 DocumentDb 更名为 CosmosRebranded DocumentDb to Cosmos

关键 Bug 修复Key bug fixes

  • 修复了以下问题:pageSize 小于存储库中的总项时排序引发异常Fixed "Sorting throws exception when pageSize is less than total items in repository"

2.1.8 (2019-10-18)2.1.8 (2019-10-18)

新增功能New features

  • 弃用 Document DB APIDeprecate Document DB APIs
  • 添加了 findByIdAndPartitionKey、deleteByIdAndPartitionKey API。Added findByIdAndPartitionKey, deleteByIdAndPartitionKey APIs.
  • 添加了基于 _etag 的乐观锁定Added Optimistic Locking based on _etag
  • 对文档集合名称启用了 SPeL 表达式Enabled SPeL expression for document collection name
  • ObjectMapper 改进。ObjectMapper improvements.

关键 Bug 修复Key bug fixes

2.1.7 (2019-10-18)2.1.7 (2019-10-18)

新增功能New features

  • 添加了 Cosmos SDK v3 依赖项Added Cosmos SDK v3 dependency
  • 添加了 Reactive Cosmos RepositoryAdded Reactive Cosmos Repository
  • 更新了 DocumentDbTemplate 的实现以使用 Cosmos SDK v3。Updated implementation of DocumentDbTemplate to use Cosmos SDK v3.
  • Reactive Cosmos Repository 支持的其他配置更改。Other configuration changes for Reactive Cosmos Repository support.

关键 Bug 修复Key bug fixes

2.1.2 (2019-03-19)2.1.2 (2019-03-19)

新增功能New features

关键 Bug 修复Key bug fixes

  • 删除 applicationInsights 依赖项以解决以下问题Remove applicationInsights dependency for
    • 依赖项污染的潜在风险Potential risk of dependencies polluting
    • Java 11 不兼容Java 11 incompatibility
    • 避免对 CPU 和/或内存产生潜在的性能影响。Avoiding potential performance impact to CPU and/or memory.

2.0.7 (2019-03-20)2.0.7 (2019-03-20)

新增功能New features

关键 Bug 修复Key bug fixes

  • 向后移植删除 applicationInsights 依赖项以解决以下问题Backport removes applicationInsights dependency for
    • 依赖项污染的潜在风险Potential risk of dependencies polluting
    • Java 11 不兼容Java 11 incompatibility
    • 避免对 CPU 和/或内存产生潜在的性能影响。Avoiding potential performance impact to CPU and/or memory.

2.1.1 (2019-03-07)2.1.1 (2019-03-07)

新增功能New features

  • 将主版本更新为 2.1.1Update master version to 2.1.1

关键 Bug 修复Key bug fixes

2.0.6 (2019-03-07)2.0.6 (2019-03-07)

新增功能New features

  • 忽略遥测中的所有异常Ignore all exceptions from telemetry

关键 Bug 修复Key bug fixes

2.1.0 (2018-12-17)2.1.0 (2018-12-17)

新增功能New features

  • 将版本更新为 2.1.0 以解决问题Update version to 2.1.0 to address issue

关键 Bug 修复Key bug fixes

2.0.5 (2018-09-13)2.0.5 (2018-09-13)

新增功能New features

  • 添加关键字 exists、startsWithAdd keyword exists, startsWith
  • 更新自述文件Update Readme

关键 Bug 修复Key bug fixes

  • 修复以下问题:无法为 Entity 直接调用 self hrefFix "Cant call self href directly for Entity"
  • 修复以下问题:如果未创建集合,findAll 将失败Fix "findAll will fail if collection is not created"

2.0.4(预发行版)(2018-08-23)2.0.4 (Pre-release) (2018-08-23)

新增功能New features

  • 将包从 documentdb 重命名为 cosmosdb,Renaming package from documentdb to cosmosdb,
  • 新增查询方法关键字功能,支持 Sql API 中的 16 个关键字。Add new feature of query method keyword, 16 keywords from Sql API supported.
  • 新增具有分页和排序的查询功能。Add new feature of query with paging and sorting.
  • 简化 spring-data-cosmosdb 的配置。Simplify the configuration of spring-data-cosmosdb.
  • 添加 deleteCollection 和 deleteAll API。Add deleteCollection and deleteAll API.

关键 Bug 修复Key bug fixes

  • Bug 修复和缺陷改进。Bug fix and defect enhancement.

常见问题FAQ

1.如何向客户通知即将停用的 SDK?1. How will customers be notified of the retiring SDK?

Azure 会在即将停用的 SDK 的支持结束之前提前 12 个月进行通知,以便协助平稳地转换到支持的 SDK。Azure will provide 12 month advance notification to the end of support of the retiring SDK in order to facilitate a smooth transition to a supported SDK. 此外,会通过各种通信渠道(Azure 管理门户、开发人员中心、博客文章以及与分配的服务管理员的直接通信)来通知客户。Further, customers will be notified through various communication channels - Azure Management Portal, Developer Center, blog post, and direct communication to assigned service administrators.

2.在这 12 个月期间,客户是否可以使用“即将”停用的 Azure Cosmos DB SDK 来创作应用程序?2. Can customers author applications using a "to-be" retired Azure Cosmos DB SDK during the 12 month period?

可以,客户在 12 个月宽限期内具有完全访问权限,可以使用“即将”停用的 Azure Cosmos DB SDK 创作、部署和修改应用程序。Yes, customers will have full access to author, deploy and modify applications using the "to-be" retired Azure Cosmos DB SDK during the 12 month grace period. 在 12 个月宽限期内,建议客户根据相应情况迁移到支持的较新版本 Azure Cosmos DB SDK。During the 12 month grace period, customers are advised to migrate to a newer supported version of Azure Cosmos DB SDK as appropriate.

3.在 12 个月通知期之后,客户是否可以使用已停用的 Azure Cosmos DB SDK 创建和修改应用程序?3. Can customers author and modify applications using a retired Azure Cosmos DB SDK after the 12 month notification period?

在 12 个月通知期之后,SDK 会停用。After the 12 month notification period, the SDK will be retired. Azure Cosmos DB 平台不允许使用已停用 SDK 的应用程序对 Azure Cosmos DB 进行任何访问。Any access to Azure Cosmos DB by an applications using a retired SDK will not be permitted by the Azure Cosmos DB platform. 此外,Azure 不会对已停用的 SDK 提供客户支持。Further, Azure will not provide customer support on the retired SDK.

4.如果客户运行使用不支持的 Azure Cosmos DB SDK 版本的应用程序,会发生什么情况?4. What happens to Customer's running applications that are using unsupported Azure Cosmos DB SDK version?

任何使用已停用 SDK 版本连接 Azure Cosmos DB 服务的尝试都会被拒绝。Any attempts made to connect to the Azure Cosmos DB service with a retired SDK version will be rejected.

5.新特性和功能是否会适用于所有未停用的 SDK?5. Will new features and functionality be applied to all non-retired SDKs?

新特性和功能只添加到新版本。New features and functionality will only be added to new versions. 如果使用的是未停用的旧版本 SDK,则对 Azure Cosmos DB 进行的请求仍会与以前一样正常工作,但是你无法访问任何新功能。If you are using an old, non-retired, version of the SDK your requests to Azure Cosmos DB will still function as previous but you will not have access to any new capabilities.

6.如果无法在截止日期之前更新应用程序,该怎么办?6. What should I do if I cannot update my application before a cut-off date?

我们建议尽早升级到最新 SDK。We recommend that you upgrade to the latest SDK as early as possible. SDK 标记为要停用之后,会有 12 个月来更新应用程序。Once an SDK has been tagged for retirement you will have 12 months to update your application. 如果由于任何原因而无法在此时间范围内完成应用程序更新,请在截止日期之前与 Cosmos DB 团队联系并请求其帮助。If, for whatever reason, you cannot complete your application update within this timeframe then please contact the Cosmos DB Team and request their assistance before the cutoff date.

后续步骤Next steps

若要了解有关 Cosmos DB 的详细信息,请参阅 Azure Cosmos DB 服务页。To learn more about Cosmos DB, see Azure Cosmos DB service page.

若要详细了解 Spring Framework,请参阅项目主页To learn more about the Spring framework, see the project home page.

若要详细了解 Spring Boot,请参阅项目主页To learn more about Spring Boot, see the project home page.

若要详细了解 Spring Data,请参阅项目主页To learn more about Spring Data, see the project home page.