java - Azure CosmosDB Java Springboot 中的无服务器帐户不支持在容器上设置优惠吞吐量或自动驾驶仪
问题描述
从 Spring Boot 应用程序连接到 Azure CosmosDB 时出错。
代码 :
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb</artifactId>
<version>2.3.0</version>
</dependency>
@Bean
public CosmosDBConfig getConfig() {
this.cosmosKeyCredential = new CosmosKeyCredential(key);
CosmosDBConfig cosmosdbConfig = CosmosDBConfig.builder(uri, this.cosmosKeyCredential, dbName)
.build();
return cosmosdbConfig;
}
@Repository
public interface UserRepository extends CosmosRepository<User, String> {}
错误信息 :
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate
[com.microsoft.azure.spring.data.cosmosdb.repository.support.SimpleCosmosRepository]:
Constructor threw exception; nested exception is com.microsoft.azure.spring.data.cosmosdb.exception.CosmosDBAccessException:
Failed to create container; nested exception is CosmosClientException{error={"code":"BadRequest","message":"Setting offer throughput or autopilot on container is not supported for serverless accounts.\r\n
ActivityId: 7e165926-0a0b-43a5-92a8-8e46fef98b47, Microsoft.Azure.Documents.Common/2.14.0,
StatusCode: BadRequest","additionalErrorInfo":null}, resourceAddress='null', statusCode=400,
message=Setting offer throughput or autopilot on container is not supported for serverless accounts.
解决方案
推荐阅读
- javascript - 试图同时改变两个元素
- typescript - 如何在打字稿中提取高阶函数的最终返回类型?
- android - 在 React Native 中打开键盘时底部标签栏向上移动
- algorithm - 如何建立一个有多个工人但没有共享内存的哈希表
- azure - 如何使用 CLI 在 Azure Devops 中构建 Web 应用 MVC5-WEB API 2?
- sql-server - 如何“管理”Visual Studio(社区)自带的ms sql server express数据库?
- windows - Windows 证书颁发机构申请表提交失败
- swift - 在注册用户时如何提供安全性?(例如:每个用户名必须不同,电子邮件必须有效等)
- java - 为什么在使用 CrudRepository spring-data-dynamodb 的 findBy 方法时出现 NullPointerException?
- mysql - 从今天起无法通过 XAMPP 连接到本地 MY SQL 数据库 (mysqli_real_connect(): (HY000/2002))