Spring Cloud Alibaba 整体架构一展

未完待续

Nacos:注册中心、配置中心

  • 如何实现服务注册

关键jar包:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
bootstrap.properties(注意:必须使用 <mark>bootstrap.properties</mark> 配置文件来配置Nacos Server 地址)
server.port=18082
spring.application.name=service-provider
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
management.endpoints.web.exposure.include=*
NOTE:

注意引用nacos配置的地方不要遗漏关键注解 @RefreshScope
如果要引用nacos配置,配置文件名称是bootstrap.properties

参考链接:

官方链接
程序猿DD

  • 如何实现服务发现、熔断、客户端负载

关键jar包:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
application.properties
spring.application.name=service-consumer
server.port=18083
management.endpoints.web.exposure.include=*
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
全部评论

相关推荐

03-16 22:00
武汉大学 C++
幸福的小熊猫想要offer:我阿里投的 c++岗,面试官说自己是做 java 的,c++这辈子才有了
点赞 评论 收藏
分享
牛客316659795号:不是,证明hr初筛已经过了,要投给部门筛一遍
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
正在热议
更多
牛客网
牛客企业服务