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 这是熔断后的方法名称
相关推荐
Crazy________5 分钟前
4.10dockerfile构建镜像
java·开发语言
阿维的博客日记16 分钟前
锁消除和锁粗化
java·逃逸分析
云烟成雨TD16 分钟前
Spring AI 1.x 系列【26】结构化输出执行流程
java·人工智能·spring
雪的季节1 小时前
qt信号槽跨线程使用时候的坑
java·开发语言·qt
chh5631 小时前
C++--内存管理
java·c语言·c++·windows·学习·面试
白緢1 小时前
嵌入式 Linux + 内核开发高频问题及排查
java·linux·运维
juniperhan1 小时前
Flink 系列第4篇:Flink 时间系统与 Timer 定时器实战精讲
java·大数据·数据仓库·flink
超级大只老咪1 小时前
一维度前缀和解题通用模板(java)
java·开发语言·算法
历程里程碑2 小时前
1 . Git本地操作:版本控制 跨平台协作 仓库核心
java·开发语言·数据结构·c++·git·gitee·github
hekung2 小时前
maven的lifecycle与idea的run
java·maven