|
1 | 1 | /* |
2 | | - * Copyright 2002-2016 the original author or authors. |
| 2 | + * Copyright 2002-2018 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
33 | 33 | import org.junit.After; |
34 | 34 | import org.junit.Test; |
35 | 35 |
|
| 36 | +import org.springframework.aop.framework.ProxyFactory; |
36 | 37 | import org.springframework.beans.DirectFieldAccessor; |
37 | 38 | import org.springframework.beans.factory.BeanCreationException; |
38 | 39 | import org.springframework.beans.factory.config.BeanDefinition; |
@@ -179,6 +180,14 @@ public void severalFixedRatesOnDefaultMethod() { |
179 | 180 | severalFixedRates(context, processorDefinition, targetDefinition); |
180 | 181 | } |
181 | 182 |
|
| 183 | + @Test |
| 184 | + public void severalFixedRatesAgainstNestedCglibProxy() { |
| 185 | + BeanDefinition processorDefinition = new RootBeanDefinition(ScheduledAnnotationBeanPostProcessor.class); |
| 186 | + BeanDefinition targetDefinition = new RootBeanDefinition(SeveralFixedRatesWithRepeatedScheduledAnnotationTestBean.class); |
| 187 | + targetDefinition.setFactoryMethodName("nestedProxy"); |
| 188 | + severalFixedRates(context, processorDefinition, targetDefinition); |
| 189 | + } |
| 190 | + |
182 | 191 | private void severalFixedRates(StaticApplicationContext context, |
183 | 192 | BeanDefinition processorDefinition, BeanDefinition targetDefinition) { |
184 | 193 |
|
@@ -631,6 +640,14 @@ static class SeveralFixedRatesWithRepeatedScheduledAnnotationTestBean { |
631 | 640 | @Scheduled(fixedRate = 4000, initialDelay = 2000) |
632 | 641 | public void fixedRate() { |
633 | 642 | } |
| 643 | + |
| 644 | + static SeveralFixedRatesWithRepeatedScheduledAnnotationTestBean nestedProxy() { |
| 645 | + ProxyFactory pf1 = new ProxyFactory(new SeveralFixedRatesWithRepeatedScheduledAnnotationTestBean()); |
| 646 | + pf1.setProxyTargetClass(true); |
| 647 | + ProxyFactory pf2 = new ProxyFactory(pf1.getProxy()); |
| 648 | + pf2.setProxyTargetClass(true); |
| 649 | + return (SeveralFixedRatesWithRepeatedScheduledAnnotationTestBean) pf2.getProxy(); |
| 650 | + } |
634 | 651 | } |
635 | 652 |
|
636 | 653 |
|
|
0 commit comments