我通过实施HealthIndicator
使用弹簧启动器。
我在自动装配AmazonSQSAsync
bean时面临问题。
我的代码段:
@Component
public class HealthCheck implements HealthIndicator {
@Autowired
AmazonSQSAsync _amazonSQSAsync;
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down()
.withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
public int check() {
// Your logic to check health
return 0;
}
}
错误:
“message”:“在上下文初始化期间遇到异常 - 取消刷新尝试: org.springframework.beans.factory.UnsatisfiedDependencyException: 创建名为'HealthCheck'的bean时出错:不满意的依赖项 通过字段'_amazonSQSAsync'表示;