spring boot 整合 sentinel

注意版本问题

我这是jdk11 、spring boot 2.7.15 、 alibaba-sentinel 2.1.2.RELEASE

复制代码
<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.15</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

<!-- sentinel客户端与dashboard通信依赖 -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
            <version>2.1.2.RELEASE</version>
        </dependency>

# sentinel-dashboard地址
spring.cloud.sentinel.transport.dashboard=localhost:8080
spring.cloud.sentinel.transport.port=8080
spring.cloud.sentinel.eager=true
spring.main.allow-circular-references=true

# 开启feign对sentinel的支持
feign.sentinel.enabled=true

@Override
    @SentinelResource(value = "helloAnother", blockHandler = "defaultFallback")
public String helloAnother(String name) {
        //xxxxxxxx
}

helloAnother 方法名写的这个 sentinel 面板上 资源名也要找到这个名称 。

复制代码
defaultFallback 这是熔断后的方法名称
相关推荐
工业互联网专业1 分钟前
基于springboot+vue的机场乘客服务系统
java·vue.js·spring boot·毕业设计·源码·课程设计·机场乘客服务系统
饕餮争锋2 分钟前
WebMvcConfigurer介绍-笔记
java·笔记·servlet
招风的黑耳8 分钟前
Java集合框架详解与使用场景示例
java·开发语言
xrkhy10 分钟前
java中XML的使用
xml·java·开发语言
胡斌附体20 分钟前
idea挂掉,会导致进程不结束,切换profile环境,导致token认证不通过
java·ide·intellij-idea·调试·token失效
y102121041 小时前
Pyhton训练营打卡Day27
java·开发语言·数据结构
AA-代码批发V哥1 小时前
Java类一文分解:JavaBean,工具类,测试类的深度剖析
java·开发语言
源码云商1 小时前
基于SpringBoot的校园周边美食探索及分享平台【附源码+数据库+文档下载】
数据库·spring boot·美食
等等5431 小时前
Java EE初阶——线程安全
java·java-ee
薯条不要番茄酱1 小时前
【SpringBoot】从零开始全面解析SpringMVC (二)
java·spring boot·后端