在spring引导应用程序中,我在yaml文件中定义了一些配置属性,如下所示。如何将Spring Boot中的配置属性注入到Spring Retry注释中?
my.app.maxAttempts = 10
my.app.backOffDelay = 500L
和示例豆
@ConfigurationProperties(prefix = "my.app")
public class ConfigProperties {
private int maxAttempts;
private long backOffDelay;
public int getMaxAttempts() {
return maxAttempts;
}
public void setMaxAttempts(int maxAttempts) {
this.maxAttempts = maxAttempts;
}
public void setBackOffDelay(long backOffDelay) {
this.backOffDelay = backOffDelay;
}
public long getBackOffDelay() {
return backOffDelay;
}
我怎么能注入的my.app.maxAttempts
和my.app.backOffdelay
春重试标注值是多少?在下面的示例中,我想将maxAttempts的值10
和退避值的500L
替换为config属性的相应引用。
@Retryable(maxAttempts=10, include=TimeoutException.class, [email protected](value = 500L))