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 这是熔断后的方法名称
相关推荐
SimonKing5 分钟前
开源神器 Navop:数据库+SSH+终端+AI,一个应用全搞定
java·后端·程序员
爱码猿8 分钟前
SpringBoot+MybatisPlus动态数据源
java·spring boot·后端
小义_9 分钟前
JDK 深度解析
java·linux·开发语言·python·面试
奈斯先生Vector30 分钟前
从“能调用”到“可运营”:AI Agent 进入多模型时代后的架构升级
java·javascript·数据库·人工智能·算法·架构·aigc
Json____33 分钟前
宿舍安全卫生检查系统:Node 全栈开发实战
java·前端·数据库·毕业设计·课程设计·毕设·wwwoop.com
pnoker36 分钟前
36 个驱动模块:应对协议碎片化
java·物联网·modbus·工业互联网·opc ua
码上有光36 分钟前
Linux:进程控制和进程替换
java·linux·服务器·进程控制·进程替换
默辨38 分钟前
我用Java后端的视角读了一遍JoyAgent-JDGenie
java·开发语言
SQL-First布道者43 分钟前
⚡ Spring JDBC 完整体系 · 第 5 讲 · Spring Boot Starter JDBC
java·spring boot·spring·mybatis·spring jdbc
宋哥转AI1 小时前
深入理解 AI Agent · 多 Agent 编排 #03:Supervisor 与 Orchestrator——Dream-SaaS 双层编排架构拆解
java·人工智能·ai