【发布时间】:2022-01-13 04:09:01
【问题描述】:
考虑下面的代码,
主类
@SpringBootApplication
@EnableCircuitBreaker
public class Main {
}
休息控制器
@PostMapping("/...")
@HystricCommand(commandProperties = { @HystrixProperty(name=”execution.isolation.thread.timeoutInMilliSeconds”, value=”${request.timeout.interval}”)})
public Object getData(){
}
当我调用这个端点时,我得到:
HystrixProperty 异常 - 无法设置 commandProperties。 groupKey:MyController,commandKey:getData,threadPool:'null'。
当我删除 -> value=”${request.timeout.interval}” 并将其硬编码为 -> value=”1000” 时,异常不再显示并且执行成功。
我们不能在这里做值映射吗?如果没有,是否可以将此属性移动到 application.properties 或通过任何配置文件全局处理该属性?
我不希望值字段与我的端点一起被硬编码,因为我的应用程序中有 10 多个端点。
【问题讨论】:
标签: java spring spring-boot hystrix circuit-breaker