没有最好只有更好,Spring Cloud组件很多,选择最合适的就好
都可以使用,个人推荐
1.Spring Cloud开发选择组件
-
服务注册中心:1.eureka 2.zookeeper 3.consul 4.nacos
选择nacos -
组件通信:1.Dubbo(RPC) 2.RestTemplate(HTTP) + Ribbon 3.OpenFeign + Ribbon
选择OpenFegin + Ribbon(更加解耦) Dubbo(效率高) -
网关:1.zuul 2.GateWay
选择GateWay -
微服务的熔断降级:1.Hystrix 2.Sentinel
选择Sentinel -
统一配置中心:1.Config 2.Config + Bus + AMQP 3.nacos
选择nacos
2.父项目的依赖管理
<!--继承springboot父项目-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.5.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR6</spring-cloud.version>
<spring.cloud.alibaba.version>2.2.1.RELEASE</spring.cloud.alibaba.version>
</properties>
<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>
<!--引入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>