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 这是熔断后的方法名称
相关推荐
customer083 小时前
【开源免费】基于SpringBoot+Vue.JS体育馆管理系统(JAVA毕业设计)
java·vue.js·spring boot·后端·开源
Miketutu3 小时前
Spring MVC消息转换器
java·spring
乔冠宇3 小时前
Java手写简单Merkle树
java·区块链·merkle树
LUCIAZZZ4 小时前
简单的SQL语句的快速复习
java·数据库·sql
komo莫莫da5 小时前
寒假刷题Day19
java·开发语言
计算机-秋大田5 小时前
基于微信小程序的电子竞技信息交流平台设计与实现(LW+源码+讲解)
spring boot·后端·微信小程序·小程序·课程设计
S-X-S5 小时前
算法总结-数组/字符串
java·数据结构·算法
linwq85 小时前
设计模式学习(二)
java·学习·设计模式
桦说编程6 小时前
CompletableFuture 超时功能有大坑!使用不当直接生产事故!
java·性能优化·函数式编程·并发编程
@_@哆啦A梦6 小时前
Redis 基础命令
java·数据库·redis