|
|
|
@ -99,11 +99,7 @@ class RetryInterceptorTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void withPostProcessorForMethod() { |
|
|
|
void withPostProcessorForMethod() { |
|
|
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
|
|
|
DefaultListableBeanFactory bf = createBeanFactoryFor(AnnotatedMethodBean.class); |
|
|
|
bf.registerBeanDefinition("bean", new RootBeanDefinition(AnnotatedMethodBean.class)); |
|
|
|
|
|
|
|
RetryAnnotationBeanPostProcessor bpp = new RetryAnnotationBeanPostProcessor(); |
|
|
|
|
|
|
|
bpp.setBeanFactory(bf); |
|
|
|
|
|
|
|
bf.addBeanPostProcessor(bpp); |
|
|
|
|
|
|
|
AnnotatedMethodBean proxy = bf.getBean(AnnotatedMethodBean.class); |
|
|
|
AnnotatedMethodBean proxy = bf.getBean(AnnotatedMethodBean.class); |
|
|
|
AnnotatedMethodBean target = (AnnotatedMethodBean) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
AnnotatedMethodBean target = (AnnotatedMethodBean) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
|
|
|
|
|
|
|
|
@ -113,11 +109,7 @@ class RetryInterceptorTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void withPostProcessorForMethodWithInterface() { |
|
|
|
void withPostProcessorForMethodWithInterface() { |
|
|
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
|
|
|
DefaultListableBeanFactory bf = createBeanFactoryFor(AnnotatedMethodBeanWithInterface.class); |
|
|
|
bf.registerBeanDefinition("bean", new RootBeanDefinition(AnnotatedMethodBeanWithInterface.class)); |
|
|
|
|
|
|
|
RetryAnnotationBeanPostProcessor bpp = new RetryAnnotationBeanPostProcessor(); |
|
|
|
|
|
|
|
bpp.setBeanFactory(bf); |
|
|
|
|
|
|
|
bf.addBeanPostProcessor(bpp); |
|
|
|
|
|
|
|
AnnotatedInterface proxy = bf.getBean(AnnotatedInterface.class); |
|
|
|
AnnotatedInterface proxy = bf.getBean(AnnotatedInterface.class); |
|
|
|
AnnotatedMethodBeanWithInterface target = (AnnotatedMethodBeanWithInterface) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
AnnotatedMethodBeanWithInterface target = (AnnotatedMethodBeanWithInterface) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
|
|
|
|
|
|
|
|
@ -179,11 +171,7 @@ class RetryInterceptorTests { |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
void withPostProcessorForClass() { |
|
|
|
void withPostProcessorForClass() { |
|
|
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
|
|
|
DefaultListableBeanFactory bf = createBeanFactoryFor(AnnotatedClassBean.class); |
|
|
|
bf.registerBeanDefinition("bean", new RootBeanDefinition(AnnotatedClassBean.class)); |
|
|
|
|
|
|
|
RetryAnnotationBeanPostProcessor bpp = new RetryAnnotationBeanPostProcessor(); |
|
|
|
|
|
|
|
bpp.setBeanFactory(bf); |
|
|
|
|
|
|
|
bf.addBeanPostProcessor(bpp); |
|
|
|
|
|
|
|
AnnotatedClassBean proxy = bf.getBean(AnnotatedClassBean.class); |
|
|
|
AnnotatedClassBean proxy = bf.getBean(AnnotatedClassBean.class); |
|
|
|
AnnotatedClassBean target = (AnnotatedClassBean) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
AnnotatedClassBean target = (AnnotatedClassBean) AopProxyUtils.getSingletonTarget(proxy); |
|
|
|
|
|
|
|
|
|
|
|
@ -324,6 +312,16 @@ class RetryInterceptorTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static DefaultListableBeanFactory createBeanFactoryFor(Class<?> beanClass) { |
|
|
|
|
|
|
|
DefaultListableBeanFactory bf = new DefaultListableBeanFactory(); |
|
|
|
|
|
|
|
bf.registerBeanDefinition("bean", new RootBeanDefinition(beanClass)); |
|
|
|
|
|
|
|
RetryAnnotationBeanPostProcessor bpp = new RetryAnnotationBeanPostProcessor(); |
|
|
|
|
|
|
|
bpp.setBeanFactory(bf); |
|
|
|
|
|
|
|
bf.addBeanPostProcessor(bpp); |
|
|
|
|
|
|
|
return bf; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class NonAnnotatedBean implements PlainInterface { |
|
|
|
static class NonAnnotatedBean implements PlainInterface { |
|
|
|
|
|
|
|
|
|
|
|
int counter = 0; |
|
|
|
int counter = 0; |
|
|
|
|