SpringBoot结合Sentinel

1.创建SpringBoot项目

添加pom依赖

<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>

2.application.yml 文件添加配置

server:
port: 8022
spring:
application:
name: sentinel-demo
cloud:
sentinel:
transport:
dashboard: 192.168.60.215:8858

3.创建service 及servicelmp

在方法名添加@SentinelResource(value = "tianlei-sentinel",fallback = "fallbackDemo")注解

备注:value为必填,fallback为方法降级触发方法名

4.登录网站查看

posted @ 2020-09-14 11:23  Ivin-yang  阅读(58)  评论(0)    收藏  举报