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 这是熔断后的方法名称
相关推荐
DKPT3 分钟前
如何确定MySQL中哪些列适合做索引
数据库·spring boot·spring·spring cloud·缓存
极客先躯15 分钟前
中级java每日一道面试题-2024年7月3日
java·开发语言·java每日一道面试题
AskHarries31 分钟前
Spring Boot集成geode快速入门Demo
java·spring boot·后端·geode
小哇66644 分钟前
SpringBoot整合Minio
java·spring boot·spring
Tech Synapse1 小时前
Java循环创建对象内存溢出怎么解决
java·开发语言·jvm
IT·陈寒1 小时前
Kotlin vs Java:深入解析两者之间的最新差异与优劣(全面指南)
java·python·kotlin
行动π技术博客1 小时前
spring中IOC相关介绍
java·spring·rpc
吃青椒的小新1 小时前
独一无二的设计模式——单例模式(Java实现)
java·后端·单例模式·设计模式
天才梦浪1 小时前
开源租房项目
java·项目
杰哥在此2 小时前
Java面试题:解释跨站脚本攻击(XSS)的原理,并讨论如何防范
java·开发语言·面试·编程·xss