springcloud-alibaba核心组件后端环境搭建
Gitee仓库地址
点我文章来源地址https://www.toymoban.com/news/detail-449355.html
- 服务注册与发现: nacos
- 配置中心: nacos
- 服务远程调用: openfeign
- 微服务网关: gateway
- 服务限流降级熔断等: sentinel
实现的功能demo
- openfeign服务远程调用
- sentinel限流测试
- gateway网关调用2个微服务
- nacos的服务注册与发现
软件架构(环境)
- jdk: 1.8
- maven: 3.5.2
- nacos: 注册中心-配置中心
- gateway: 微服务网关
- openfeign: 服务远程调用
- sentinel: 熔断,限流,服务保护等
nacos上等相关配置
order服务
- dataId: cloud-order-dev.yaml
- Group: DEV_GROUP
server:
port: 8081
spring:
application:
name: cloud-order
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace: 0d497b0f-19fe-47f3-a5d0-6499c698841a
group: DEV_GROUP
sentinel:
transport:
dashboard: localhost:8089
eager: true
feign:
sentinel:
enabled: true
user服务
- dataId: cloud-user-dev.yaml
- Group: DEV_GROUP
server:
port: 8082
spring:
application:
name: cloud-user
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace: 0d497b0f-19fe-47f3-a5d0-6499c698841a
group: DEV_GROUP
sentinel:
transport:
dashboard: localhost:8089
eager: true
feign:
sentinel:
enabled: true
gateway
- dataId: cloud-gateway-dev.yaml
- Group: DEV_GROUP
server:
port: 8083
spring:
cloud:
nacos:
discovery:
server-addr: localhost:8848
namespace: 0d497b0f-19fe-47f3-a5d0-6499c698841a
group: DEV_GROUP
gateway:
globalcors:
corsConfigurations:
'[/**]':
allowedOrigins: "*"
allowedHeaders: "*"
allowCredentials: true
allowedMethods:
- GET
- POST
- PUT
- DELETE
routes:
- id: cloud-order
uri: lb://cloud-order
predicates:
- Path=/cloud-order/**
filters:
- StripPrefix=1
- id: cloud-user
uri: lb://cloud-user
predicates:
- Path=/cloud-user/**
filters:
- StripPrefix=1
application:
name: cloud-gateway
文章来源:https://www.toymoban.com/news/detail-449355.html
到了这里,关于springcloud-alibaba五大核心组件-后端开发工程(脚手架)搭建的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!