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 这是熔断后的方法名称
相关推荐
吾日三省吾码16 分钟前
Spring 团队详解:AOT 缓存实践、JSpecify 空指针安全与支持策略升级
java·spring·缓存
风象南35 分钟前
SpringBoot的5种日志输出规范策略
java·spring boot·后端
咖啡啡不加糖42 分钟前
深入理解MySQL死锁:从原理、案例到解决方案
java·数据库·mysql
zimoyin43 分钟前
Compose Multiplatform 实现自定义的系统托盘,解决托盘乱码问题
java
啾啾Fun1 小时前
【Java微服务组件】分布式协调P4-一文打通Redisson:从API实战到分布式锁核心源码剖析
java·redis·分布式·微服务·lua·redisson
消失的旧时光-19431 小时前
Android USB 通信开发
android·java
梁云亮1 小时前
Spring Boot + Thymeleaf 防重复提交
spring boot·防抖·防重复提交
惊鸿一博1 小时前
java_网络服务相关_gateway_nacos_feign区别联系
java·开发语言·gateway
朝新_7 小时前
【多线程初阶】阻塞队列 & 生产者消费者模型
java·开发语言·javaee
立莹Sir8 小时前
Calendar类日期设置进位问题
java·开发语言