开发者社区 > 云原生 > 正文

当我将属性绑定到sentinel规则类型时,文件和nacos总是失败

#File spring.cloud.sentinel.datasource.ds2.file.file=classpath: flowrule.json spring.cloud.sentinel.datasource.ds2.file.data-type=json spring.cloud.sentinel.datasource.ds2.file.rule-type=flow

#Nacos spring.cloud.sentinel.datasource.ds2.nacos.file=classpath: flowrule.json spring.cloud.sentinel.datasource.ds2.nacos.dataId=sentinel spring.cloud.sentinel.datasource.ds2.nacos.groupId=DEFAULT_GROUP spring.cloud.sentinel.datasource.ds2.nacos.data-type=json spring.cloud.sentinel.datasource.ds2.nacos.rule-type=flow

Failed to bind properties under 'spring.cloud.sentinel.datasource.ds2.file.rule-type' to org.springframework.cloud.alibaba.sentinel.datasource.RuleType:

Property: spring.cloud.sentinel.datasource.ds2.file.rule-type Value: flow Origin: class path resource [application.properties]:5:53 Reason: 2

我为此困扰了很长一段时间。

4.0.0 com.example.sc sctest1 0.0.1-SNAPSHOT sctest1 Demo project for Spring Boot pom

<spring-boot.version>2.0.9.RELEASE</spring-boot.version> <spring-cloud.version>Finchley.RELEASE</spring-cloud.version> <spring-clousd-alibaba-dependencies.version>0.2.2.RELEASE</spring-clousd-alibaba-dependencies.version> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target>

org.springframework.boot spring-boot-dependencies ${spring-boot.version} pom import org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import

org.springframework.cloud spring-cloud-starter-alibaba-sentinel 0.2.2.RELEASE

org.springframework.boot spring-boot-starter-actuator

org.springframework.boot spring-boot-starter-web

原提问者GitHub用户xiaweiasd

展开
收起
白夜行fighting 2023-06-11 10:38:37 79 0
1 条回答
写回答
取消 提交回答
  • 使用sentinel规则的文件或nacos中不可能存在其他属性。它可以在下一个版本中存在其他属性。

    原回答者GitHub用户fangjian0423

    2023-06-11 11:29:56
    赞同 展开评论 打赏

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
阿里云容器 AHAS Sentinel 网关流控揭秘 立即下载
workshop专场-微服务专场-开发者动手实践营-微服务-使用Nacos进行服务的动态发现和流量调度 立即下载
Nacos 启航,发布第一个版本, 云原生时代助力用户微服务平台建设 立即下载