Spring Boot 2.2.4 版本与 azure spring data cosmos 3.xx 不兼容
我正在使用 cosmos api 处理 springboot,因此,如果我使用 azure-spring-data-cosmos 库(3.xx)提供的 @Query 和 Springboot 2.5.0 能够从 cosmos 数据库获取结果。但是如果我使用相同的 azure-spring-data-cosmos 库(3.xx) 和 springboot 2.2.4 则低于异常
Field userRepository in com.example.service.UserService required a bean of type 'com.example.repository.UserRepository' that could not be found.The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:Consider defining a bean of type 'com.example.repository.UserRepository' in your configuration.
I'm working on springboot with cosmos api,So if i use @Query that is provided by azure-spring-data-cosmos library(3.x.x) with Springboot 2.5.0 able to get the results from cosmos database. But if i use the same azure-spring-data-cosmos library(3.x.x) with springboot 2.2.4 getting below exception
Field userRepository in com.example.service.UserService required a bean of type 'com.example.repository.UserRepository' that could not be found.The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:Consider defining a bean of type 'com.example.repository.UserRepository' in your configuration.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我强烈建议使用最新的 azure-spring-data-cosmos SDK 版本 3.19.0 - https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md#3190-2022-03-10
由于 Spring Boot 每 6 个月发布一个主要版本,azure spring 团队支持 Spring Boot 的最后 2 个版本。我们目前支持 Spring Boot 2.5.x 和 2.6.x。您应该能够将这些版本的 spring-boot 与最新版本的 azure-spring-data-cosmos SDK 一起使用。
changelog 指向可与 azure-spring-data-cosmos SDK 一起使用的 spring boot 的兼容版本。
此外,spring-boot 2.2.4 此时已经有 2 年多了。我们不再支持它了。
I would highly recommend using the latest azure-spring-data-cosmos SDK version 3.19.0 - https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md#3190-2022-03-10
Since spring boot releases one major version every 6 months, azure spring team supports last 2 versions of Spring Boot. We currently support spring boot 2.5.x and 2.6.x. You should be able to use any one of these versions of spring-boot with latest version of azure-spring-data-cosmos SDK.
The changelog points to the compatible version of spring boot which can be used with azure-spring-data-cosmos SDK.
Also, spring-boot 2.2.4 is more than 2 years old at this point of time. We don't support it anymore.
不确定您使用的是哪个版本的 cosmos,但 cosmos 更改日志明确提到
3.5.0
有 spring boot 支持2.4.3
&多于。请检查您的 Cosmos 版本是否为
3.5.0
,这可能会导致此问题。参考链接:
https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md#350-2021-03-11
Not sure which version of cosmos you are using but cosmos change log clearly mentions that
3.5.0
has spring boot support2.4.3
& above.Please check if your cosmos version is
3.5.0
which might be causing this issue.Reference link :
https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/cosmos/azure-spring-data-cosmos/CHANGELOG.md#350-2021-03-11