1
1
/*
2
- * Copyright 2002-2013 the original author or authors.
2
+ * Copyright 2002-2016 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.
@@ -58,6 +58,7 @@ public void asyncMethods() throws Exception {
58
58
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
59
59
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
60
60
context .refresh ();
61
+
61
62
AsyncMethodBean asyncTest = context .getBean ("asyncTest" , AsyncMethodBean .class );
62
63
asyncTest .doNothing (5 );
63
64
asyncTest .doSomething (10 );
@@ -73,6 +74,7 @@ public void asyncMethodsThroughInterface() throws Exception {
73
74
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
74
75
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
75
76
context .refresh ();
77
+
76
78
SimpleInterface asyncTest = context .getBean ("asyncTest" , SimpleInterface .class );
77
79
asyncTest .doNothing (5 );
78
80
asyncTest .doSomething (10 );
@@ -91,6 +93,7 @@ public void asyncMethodsWithQualifier() throws Exception {
91
93
context .registerBeanDefinition ("e1" , new RootBeanDefinition (ThreadPoolTaskExecutor .class ));
92
94
context .registerBeanDefinition ("e2" , new RootBeanDefinition (ThreadPoolTaskExecutor .class ));
93
95
context .refresh ();
96
+
94
97
AsyncMethodWithQualifierBean asyncTest = context .getBean ("asyncTest" , AsyncMethodWithQualifierBean .class );
95
98
asyncTest .doNothing (5 );
96
99
asyncTest .doSomething (10 );
@@ -111,6 +114,7 @@ public void asyncMethodsWithQualifierThroughInterface() throws Exception {
111
114
context .registerBeanDefinition ("e1" , new RootBeanDefinition (ThreadPoolTaskExecutor .class ));
112
115
context .registerBeanDefinition ("e2" , new RootBeanDefinition (ThreadPoolTaskExecutor .class ));
113
116
context .refresh ();
117
+
114
118
SimpleInterface asyncTest = context .getBean ("asyncTest" , SimpleInterface .class );
115
119
asyncTest .doNothing (5 );
116
120
asyncTest .doSomething (10 );
@@ -128,6 +132,7 @@ public void asyncClass() throws Exception {
128
132
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
129
133
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
130
134
context .refresh ();
135
+
131
136
AsyncClassBean asyncTest = context .getBean ("asyncTest" , AsyncClassBean .class );
132
137
asyncTest .doSomething (10 );
133
138
Future <String > future = asyncTest .returnSomething (20 );
@@ -141,6 +146,7 @@ public void asyncClassWithPostProcessor() throws Exception {
141
146
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (AsyncClassBean .class ));
142
147
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
143
148
context .refresh ();
149
+
144
150
AsyncClassBean asyncTest = context .getBean ("asyncTest" , AsyncClassBean .class );
145
151
asyncTest .doSomething (10 );
146
152
Future <String > future = asyncTest .returnSomething (20 );
@@ -155,6 +161,7 @@ public void asyncClassWithInterface() throws Exception {
155
161
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
156
162
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
157
163
context .refresh ();
164
+
158
165
RegularInterface asyncTest = context .getBean ("asyncTest" , RegularInterface .class );
159
166
asyncTest .doSomething (10 );
160
167
Future <String > future = asyncTest .returnSomething (20 );
@@ -168,6 +175,7 @@ public void asyncClassWithInterfaceAndPostProcessor() throws Exception {
168
175
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (AsyncClassBeanWithInterface .class ));
169
176
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
170
177
context .refresh ();
178
+
171
179
RegularInterface asyncTest = context .getBean ("asyncTest" , RegularInterface .class );
172
180
asyncTest .doSomething (10 );
173
181
Future <String > future = asyncTest .returnSomething (20 );
@@ -182,6 +190,7 @@ public void asyncInterface() throws Exception {
182
190
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
183
191
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
184
192
context .refresh ();
193
+
185
194
AsyncInterface asyncTest = context .getBean ("asyncTest" , AsyncInterface .class );
186
195
asyncTest .doSomething (10 );
187
196
Future <String > future = asyncTest .returnSomething (20 );
@@ -195,6 +204,7 @@ public void asyncInterfaceWithPostProcessor() throws Exception {
195
204
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (AsyncInterfaceBean .class ));
196
205
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
197
206
context .refresh ();
207
+
198
208
AsyncInterface asyncTest = context .getBean ("asyncTest" , AsyncInterface .class );
199
209
asyncTest .doSomething (10 );
200
210
Future <String > future = asyncTest .returnSomething (20 );
@@ -209,6 +219,7 @@ public void dynamicAsyncInterface() throws Exception {
209
219
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
210
220
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
211
221
context .refresh ();
222
+
212
223
AsyncInterface asyncTest = context .getBean ("asyncTest" , AsyncInterface .class );
213
224
asyncTest .doSomething (10 );
214
225
Future <String > future = asyncTest .returnSomething (20 );
@@ -222,6 +233,7 @@ public void dynamicAsyncInterfaceWithPostProcessor() throws Exception {
222
233
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (DynamicAsyncInterfaceBean .class ));
223
234
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
224
235
context .refresh ();
236
+
225
237
AsyncInterface asyncTest = context .getBean ("asyncTest" , AsyncInterface .class );
226
238
asyncTest .doSomething (10 );
227
239
Future <String > future = asyncTest .returnSomething (20 );
@@ -236,6 +248,7 @@ public void asyncMethodsInInterface() throws Exception {
236
248
context .registerBeanDefinition ("autoProxyCreator" , new RootBeanDefinition (DefaultAdvisorAutoProxyCreator .class ));
237
249
context .registerBeanDefinition ("asyncAdvisor" , new RootBeanDefinition (AsyncAnnotationAdvisor .class ));
238
250
context .refresh ();
251
+
239
252
AsyncMethodsInterface asyncTest = context .getBean ("asyncTest" , AsyncMethodsInterface .class );
240
253
asyncTest .doNothing (5 );
241
254
asyncTest .doSomething (10 );
@@ -250,6 +263,7 @@ public void asyncMethodsInInterfaceWithPostProcessor() throws Exception {
250
263
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (AsyncMethodsInterfaceBean .class ));
251
264
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
252
265
context .refresh ();
266
+
253
267
AsyncMethodsInterface asyncTest = context .getBean ("asyncTest" , AsyncMethodsInterface .class );
254
268
asyncTest .doNothing (5 );
255
269
asyncTest .doSomething (10 );
@@ -264,6 +278,7 @@ public void dynamicAsyncMethodsInInterfaceWithPostProcessor() throws Exception {
264
278
context .registerBeanDefinition ("asyncTest" , new RootBeanDefinition (DynamicAsyncMethodsInterfaceBean .class ));
265
279
context .registerBeanDefinition ("asyncProcessor" , new RootBeanDefinition (AsyncAnnotationBeanPostProcessor .class ));
266
280
context .refresh ();
281
+
267
282
AsyncMethodsInterface asyncTest = context .getBean ("asyncTest" , AsyncMethodsInterface .class );
268
283
asyncTest .doSomething (10 );
269
284
Future <String > future = asyncTest .returnSomething (20 );
@@ -461,7 +476,7 @@ public static class DynamicAsyncInterfaceBean implements FactoryBean<AsyncInterf
461
476
private final AsyncInterface proxy ;
462
477
463
478
public DynamicAsyncInterfaceBean () {
464
- ProxyFactory pf = new ProxyFactory (new HashMap <>());
479
+ ProxyFactory pf = new ProxyFactory (new HashMap <String , String >());
465
480
DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor (new MethodInterceptor () {
466
481
@ Override
467
482
public Object invoke (MethodInvocation invocation ) throws Throwable {
@@ -531,7 +546,7 @@ public static class DynamicAsyncMethodsInterfaceBean implements FactoryBean<Asyn
531
546
private final AsyncMethodsInterface proxy ;
532
547
533
548
public DynamicAsyncMethodsInterfaceBean () {
534
- ProxyFactory pf = new ProxyFactory (new HashMap <>());
549
+ ProxyFactory pf = new ProxyFactory (new HashMap <String , String >());
535
550
DefaultIntroductionAdvisor advisor = new DefaultIntroductionAdvisor (new MethodInterceptor () {
536
551
@ Override
537
552
public Object invoke (MethodInvocation invocation ) throws Throwable {
0 commit comments