diff --git a/ci/images/ci-image/Dockerfile b/ci/images/ci-image/Dockerfile
index 4e4e318..14ed95c 100644
--- a/ci/images/ci-image/Dockerfile
+++ b/ci/images/ci-image/Dockerfile
@@ -2,7 +2,7 @@ FROM ubuntu:focal-20220404
ADD setup.sh /setup.sh
ADD get-jdk-url.sh /get-jdk-url.sh
-RUN ./setup.sh java8
+RUN ./setup.sh java17
ENV JAVA_HOME /opt/openjdk
ENV PATH $JAVA_HOME/bin:$PATH
\ No newline at end of file
diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh
index f71d8e1..ccaf002 100755
--- a/ci/images/get-jdk-url.sh
+++ b/ci/images/get-jdk-url.sh
@@ -2,8 +2,8 @@
set -e
case "$1" in
- java8)
- echo "https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u322-b06/OpenJDK8U-jdk_x64_linux_hotspot_8u322b06.tar.gz"
+ java17)
+ echo "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.2%2B8/OpenJDK17U-jdk_x64_linux_hotspot_17.0.2_8.tar.gz"
;;
*)
echo $"Unknown java version"
diff --git a/pom.xml b/pom.xml
index 878e7c9..2188899 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,12 +28,12 @@
2.0.0-SNAPSHOT
false
- 1.8
+ 17
true
UTF-8
UTF-8
- 4.3.29.RELEASE
+ 6.0.0-SNAPSHOT
diff --git a/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java b/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java
index dac3cb5..44af456 100644
--- a/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java
+++ b/src/main/java/org/springframework/retry/annotation/RetryConfiguration.java
@@ -39,6 +39,7 @@ import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.ListableBeanFactory;
+import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Role;
import org.springframework.core.OrderComparator;
@@ -51,7 +52,6 @@ import org.springframework.retry.policy.RetryContextCache;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
-import org.springframework.util.ReflectionUtils.MethodCallback;
/**
* Basic configuration for @Retryable processing. For stateful retry, if
@@ -62,6 +62,7 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
* @author Dave Syer
* @author Artem Bilan
* @author Markus Heiden
+ * @author Gary Russell
* @since 1.1
*
*/
@@ -69,9 +70,9 @@ import org.springframework.util.ReflectionUtils.MethodCallback;
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
@Component
public class RetryConfiguration extends AbstractPointcutAdvisor
- implements IntroductionAdvisor, BeanFactoryAware, InitializingBean {
+ implements IntroductionAdvisor, BeanFactoryAware, InitializingBean, SmartInitializingSingleton {
- private Advice advice;
+ private AnnotationAwareRetryOperationsInterceptor advice;
private Pointcut pointcut;
@@ -92,7 +93,6 @@ public class RetryConfiguration extends AbstractPointcutAdvisor
this.retryContextCache = findBean(RetryContextCache.class);
this.methodArgumentsKeyGenerator = findBean(MethodArgumentsKeyGenerator.class);
this.newMethodArgumentsIdentifier = findBean(NewMethodArgumentsIdentifier.class);
- this.retryListeners = findBeans(RetryListener.class);
this.sleeper = findBean(Sleeper.class);
Set> retryableAnnotationTypes = new LinkedHashSet<>(1);
retryableAnnotationTypes.add(Retryable.class);
@@ -103,6 +103,14 @@ public class RetryConfiguration extends AbstractPointcutAdvisor
}
}
+ @Override
+ public void afterSingletonsInstantiated() {
+ this.retryListeners = findBeans(RetryListener.class);
+ if (this.retryListeners != null) {
+ this.advice.setListeners(this.retryListeners);
+ }
+ }
+
private List findBeans(Class extends T> type) {
if (this.beanFactory instanceof ListableBeanFactory) {
ListableBeanFactory listable = (ListableBeanFactory) this.beanFactory;
@@ -157,14 +165,11 @@ public class RetryConfiguration extends AbstractPointcutAdvisor
return this.pointcut;
}
- protected Advice buildAdvice() {
+ protected AnnotationAwareRetryOperationsInterceptor buildAdvice() {
AnnotationAwareRetryOperationsInterceptor interceptor = new AnnotationAwareRetryOperationsInterceptor();
if (this.retryContextCache != null) {
interceptor.setRetryContextCache(this.retryContextCache);
}
- if (this.retryListeners != null) {
- interceptor.setListeners(this.retryListeners);
- }
if (this.methodArgumentsKeyGenerator != null) {
interceptor.setKeyGenerator(this.methodArgumentsKeyGenerator);
}