zoukankan      html  css  js  c++  java
  • SpringBoot整合Nacos,OpenFeign,Dubbo遇到的依赖问题 一年

    首先确定SpringBoot版本,可参考SpringCloudAlibaba
    如果要引入SpringCloud相关组件,版本号要和SpringCloud一致,这样可以避免相当多莫名其妙的问题。

    放一份可用的依赖版本

        <properties>
            <java.version>11</java.version>
            <spring-cloud.version>Hoxton.SR9</spring-cloud.version>
            <spring-boot.version>2.3.2.RELEASE</spring-boot.version>
            <spring-cloud-alibaba.version>2.2.6.RELEASE</spring-cloud-alibaba.version>
        </properties>
        <dependencies>
            <!--SpringBoot Web-->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
            </dependency>
            <!--Nacos Config-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            </dependency>
            <!--Nacos Discovery-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-loadbalancer</artifactId>
                <version>${spring-cloud-alibaba.version}</version>
            </dependency>
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            </dependency>
            <!--openfeign-->
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-openfeign</artifactId>
                <version>${spring-cloud-alibaba.version}</version>
            </dependency>
            <!--Spring-Cloud-Dubbo-->
            <dependency>
                <groupId>com.alibaba.cloud</groupId>
                <artifactId>spring-cloud-starter-dubbo</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
            </dependency>
        </dependencies>
        <dependencyManagement>
            <dependencies>
                <!--SpringCloud Alibaba-->
                <dependency>
                    <groupId>com.alibaba.cloud</groupId>
                    <artifactId>spring-cloud-alibaba-dependencies</artifactId>
                    <version>${spring-cloud-alibaba.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <!--SpringBoot-->
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-dependencies</artifactId>
                    <version>${spring-boot.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
                <!--SpringCloud-->
                <dependency>
                    <groupId>org.springframework.cloud</groupId>
                    <artifactId>spring-cloud-dependencies</artifactId>
                    <version>${spring-cloud.version}</version>
                    <type>pom</type>
                    <scope>import</scope>
                </dependency>
            </dependencies>
        </dependencyManagement>
    
    spring:
      cloud:
        loadbalancer:
          ribbon:
            enabled: false  # 禁用 Nacos 中的 netflix-ribbon
    

    如有错漏,欢迎指正!谢绝转载。
  • 相关阅读:
    202104-2 邻域均值
    202104-1 灰度直方图
    1384. 饲料调配
    1381. 阶乘
    264. 丑数 II
    1380. 邮票
    42 新安装的idea必备设置
    41 cmd中解除被占用的端口
    40 文件在线预览
    39 进度条使用
  • 原文地址:https://www.cnblogs.com/srczhang/p/15630118.html
Copyright © 2011-2022 走看看