restful限流
1.引入依赖
<dependency>
<groupId>com.xy</groupId>
<artifactId>xy-core-framework-flow-sentinel</artifactId>
<version>${xy-core-framework-flow-sentinel-version}</version>
</dependency>
2.添加配置
########################### 负载均衡 ##############################################
spring.cloud.loadbalancer.retry.enabled=true
spring.cloud.sentinel.enabled=true
spring.cloud.sentinel.transport.dashboard=${local.ip}:8858
spring.cloud.sentinel.transport.port=8719
#应用与Sentinel控制台的心跳间隔时间
spring.cloud.sentinel.transport.heartbeat-interval-ms=1000
#Sentinel自动化配置是否生效
spring.cloud.sentinel.filter.enabled=true
spring.cloud.sentinel.metric.charset=UTF-8
#取消Sentinel控制台懒加载
spring.cloud.sentinel.eager=true
#Sentinel 日志文件所在的目录
spring.cloud.sentinel.log.dir=./logs/${spring.application.name}/sentinel
#默认开启
spring.cloud.sentinel.xy.enable=true
#默认开启
spring.cloud.sentinel.xy.mvc-interceptor-enable=true
#默认关闭
spring.cloud.sentinel.xy.total-interceptor-enable=false
dubbo限流
1.引入依赖
<dependency>
<groupId>com.xy</groupId>
<artifactId>xy-core-framework-flow-sentinel-dubbo-adapter</artifactId>
<version>${xy-core-framework-flow-sentinel-dubbo-version}</version>
</dependency>