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 这是熔断后的方法名称
相关推荐
小江的记录本3 分钟前
【Redis】Redis常用命令速查表(完整版)
java·前端·数据库·redis·后端·spring·缓存
卓怡学长4 分钟前
m281基于SSM框架的电脑测评系统
java·数据库·spring·tomcat·maven·intellij-idea
umeelove357 分钟前
SQL中的DISTINCT、SQL DISTINCT详解、DISTINCT的用法、DISTINCT注意事项
java·数据库·sql
AMoon丶8 分钟前
Golang--垃圾回收
java·linux·开发语言·jvm·后端·算法·golang
填满你的记忆8 分钟前
RAG 架构在实际项目中的应用(从原理到落地)
java·ai·架构
Densen201411 分钟前
企业H5站点升级PWA (二)
java·后端·spring
Aaa1111144312 分钟前
限流算法 限流算法
java·开发语言
李子琪。18 分钟前
基于“产业-空间-社会”三重网络的传统工业城市现代化转型路径研究——以广西柳州市典型
java·人工智能·经验分享
zjneymar20 分钟前
Mybatis的动态sql
java·sql·mybatis
花月C25 分钟前
基于WebSocket的 “聊天” 业务设计与实战指南
java·网络·后端·websocket·网络协议