官网代码案例:
注意:
1. 引入依赖
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
2. 配置文件application.yml
spring:cloud:sentinel:transport:port: 8719dashboard: localhost:8080
3. 实时监控
3.1 引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
4. 自定义sentinel 流控返回数据
默认返回: