spring cloud集成sentinel报错
Sentinel
alibaba/Sentinel: Sentinel 是阿里巴巴开源的一款面向分布式服务架构的流量控制、熔断降级组件,提供实时监控、限流、降级和系统保护功能,适用于微服务治理场景。
项目地址:https://gitcode.com/gh_mirrors/sentine/Sentinel
·
sentinel是阿里巴巴的服务保护框架,可以限流、熔断等。
但是我在系统中引入sentinel包后系统就报错:
2022-07-27 17:17:05.410 WARN 20124 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration': Unsatisfied dependency expressed through field 'properties'; nested exception is org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'spring.cloud.sentinel-com.alibaba.cloud.sentinel.SentinelProperties': Could not bind properties to 'SentinelProperties' : prefix=spring.cloud.sentinel, ignoreInvalidFields=false, ignoreUnknownFields=true; nested exception is javax.validation.NoProviderFoundException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
2022-07-27 17:17:05.419 INFO 20124 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-07-27 17:17:05.459 ERROR 20124 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The Bean Validation API is on the classpath but no implementation could be found
Action:
Add an implementation, such as Hibernate Validator, to the classpath
我用了一天的时间参找到错误。
因为我的系统中使用swagger规范文档插件,以及knife4j界面加强工具。
其中knife4j架包与sentinel冲突
<!-- knife4j 接口文档界面显示加强 -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
<!-- 去除validation-api -->
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
之后就可以了
参考
点击跳转
alibaba/Sentinel: Sentinel 是阿里巴巴开源的一款面向分布式服务架构的流量控制、熔断降级组件,提供实时监控、限流、降级和系统保护功能,适用于微服务治理场景。
最近提交(Master分支:4 个月前 )
222670e6
* fix: Endpoint#toString host formatting; add Endpoint unit test
* test: remove empty EndpointTest.java (fix accidental PR changes)
---------
Signed-off-by: 赖尧 <yujitang_2006@qq.com> 26 天前
e7a9c560
* chore: remove node_modules from git & add to .gitignore
* fix(docs): normalize README table style (MD060) across adapters and cluster modules
* docs: fix compact table style in parameter flow README
* docs: fix markdownlint MD009 and MD060 in README files
* docs: fix table format in parameter-flow-control README (MD060/MD009)
* docs: fix table format in spring-webmvc README files (MD060/MD009)
* fix: restore UTF-8 encoding and fix markdownlint errors
* fix: wrap remaining bare URLs with angle brackets (MD034)
* fix: remove trailing spaces from table rows (MD009)
---------
Signed-off-by: 赖尧 <yujitang_2006@qq.com> 1 个月前
AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。
更多推荐



所有评论(0)