Spring cloud application.yml未被hystrix拾取
我想将方法注释中的以下配置移动到属性文件Spring cloud application.yml未被hystrix拾取,spring-cloud,hystrix,netflix,spring-cloud-netflix,Spring Cloud,Hystrix,Netflix,Spring Cloud Netflix,我想将方法注释中的以下配置移动到属性文件 @HystrixCommand(commandProperties = { @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "10000"), @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "10000
@HystrixCommand(commandProperties = {
@HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "10000"),
@HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "10000"),
@HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "5"),
@HystrixProperty(name = "circuitBreaker.errorThresholdPercentage", value = "100")
},
fallbackMethod = "fallbackCall")
我已将application.yml文件放在src/main/resources下
hystrix:
command.:
getResult:
circuitBreaker:
sleepWindowInMilliseconds: 10000
errorThresholdPercentage: 100
requestVolumeThreshold: 5
metrics:
rollingStats:
timeInMilliseconds: 10000
我不使用弹簧靴。Hystrix无法获取此文件
要将application.yml传递到hystrix配置,是否需要进行任何配置?创建为config.properties,并且可以正常工作。 这是默认情况下由archaius查找的
hystrix.command.getResult.metrics.rollingStats.timeInMilliseconds=10000
hystrix.command.getResult.circuitBreaker.requestVolumeThreshold=5
hystrix.command.getResult.circuitBreaker.errorThresholdPercentage=100
hystrix.command.getResult.circuitBreaker.sleepWindowInMilliseconds=10000
我遇到了类似的问题,我们在项目中使用Spring引导和Spring云依赖。添加以下依赖项已解决此问题
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>${version-as-per-your-project}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
org.springframework.cloud
spring cloud starter netflix hystrix
${根据您的项目的版本}
我们最初测试的依赖性低于导致问题的依赖性
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>${version-as-per-your-project}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
org.springframework.cloud
春云
有一座桥,它确实起作用。你的依赖关系肯定有问题,你是如何引入hystrix的?