application.yml 未被 hystrix 拾取
application.yml not picked up by hystrix
我想将方法注释中的以下配置移动到 属性 文件
@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
我没有使用 spring 启动。 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>
我想将方法注释中的以下配置移动到 属性 文件
@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
我没有使用 spring 启动。 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>