广告
返回顶部
首页 > 资讯 > 后端开发 > Python >springboot与dubbo的版本匹配问题
  • 762
分享到

springboot与dubbo的版本匹配问题

2024-04-02 19:04:59 762人浏览 薄情痞子

Python 官方文档:入门教程 => 点击学习

摘要

目录SpringBoot与dubbo的版本匹配项目里原始版本升级到2.6.7后错误日志springboot+dubbo版本对应关系背景对应关系springboot与dubbo的版本匹

springboot与dubbo的版本匹配

官方链接

参考:

在这里插入图片描述

项目里原始版本

  • springboot:2.1.6.RELEASE
  • dubbo-spring-boot-starter : 0.2.1.RELEASE
  • dubbo: 2.6.5

上面这么写是可以正常运行的。但是当把dubbo升级到2.6.7时候,却报错了,异常如下:

升级到2.6.7后错误日志

Description:

The bean 'dubboConfiGConfiguration.Single', defined in null, could not be reGIStered. A bean with that name has already been defined in null and overriding is disabled.

Action:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

后来经过尝试,把springboot的版本下调到2.0.9时候,项目可以正常启动。

所以得到下面这个版本匹配的结论:

2.7版本以下的,使用的是alibaba目录下的jar,

springbootdubbo-springdubbo注1.x0.1.2.RELEASE2.6.5+2.6.6以上的dubbo需要配置Netty-alljar包2.0.0~2.0.90.2.1.RELEASE2.6.5/2.6.6/2.6.72.1.x0.2.1.RELEASE2.6.5 /2.7.1

2.7版本以上的,用apache目录下面的jar,dubbo-spring和dubbo都使用apache下面的版本,统一使用2.7即可,springboot也可以用2.1.x以上

springboot+dubbo版本对应关系

背景

springboot 和 dubbo 在 pom.xml 中的版本是有对应关系的,如果配置的依赖不按照对应关系配置的话项目启动就会报错,报错的信息如下所示:

java.lang.IllegalStateException: Cannot load configuration class: com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration
at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:249) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:283) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:127) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525) ~[spring-context-4.3.12.RELEASE.jar:4.3.12.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWEBApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
at com.ProviderApplication.main(ProviderApplication.java:13) [classes/:na]

对应关系

我在项目中使用的阿里巴巴的 dubbo-spring-boot-starter 版本是 0.2.0 ,Maven 依赖如下所示:


<dependency>
    <groupId>com.alibaba.boot</groupId>
    <artifactId>dubbo-spring-boot-starter</artifactId>
    <version>0.2.0</version>
</dependency>

则对应的使用 spring-boot-starter-parent 的版本号是 2.1.6.RELEASE ,这样配置依赖的话,项目启动是没有问题的。

Dubbo Spring Boot Dubbo Spring Boot
0.2.1.RELEASE 2.6.5+ 2.x
0.1.2.RELEASE 2.6.5+ 1.x

可以在 https://mvnrepository.com/artifact/com.alibaba.boot/dubbo-spring-boot-starter 里面查看 dubbo 的所有版本信息。

以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。

--结束END--

本文标题: springboot与dubbo的版本匹配问题

本文链接: https://www.lsjlt.com/news/154355.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作