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 这是熔断后的方法名称
相关推荐
朝九晚五ฺ2 分钟前
从零到实战:鲲鹏平台 HPC 技术栈与并行计算
java·开发语言
CUIYD_19893 分钟前
Freemarker 无法转译 & 字符
java·开发语言·spring
自在极意功。11 分钟前
简单介绍SpringMVC
java·mvc·springmvc·三层架构
Yuiiii__16 分钟前
一次并不简单的 Spring 循环依赖排查
java·开发语言·数据库
tkevinjd16 分钟前
JUC4(生产者-消费者)
java·多线程·juc
野槐17 分钟前
java基础-面向对象
java·开发语言
sww_102621 分钟前
Openfeign源码浅析
java·spring cloud
X***07881 小时前
从语言演进到工程实践全面解析C++在现代软件开发中的设计思想性能优势与长期生命力
java·开发语言
smileNicky1 小时前
SpringBoot系列之集成Pulsar教程
java·spring boot·后端
Sammyyyyy1 小时前
Rust 1.92.0 发布:Never Type 进一步稳定
java·算法·rust