|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2017 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.
|
|
22 | 22 |
|
23 | 23 | import org.junit.Test;
|
24 | 24 |
|
| 25 | +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; |
25 | 26 | import org.springframework.beans.factory.BeanCreationException;
|
26 | 27 | import org.springframework.beans.factory.support.RootBeanDefinition;
|
27 | 28 | import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
|
28 | 29 | import org.springframework.context.support.GenericApplicationContext;
|
| 30 | +import org.springframework.scheduling.annotation.Async; |
| 31 | +import org.springframework.scheduling.annotation.AsyncAnnotationAdvisor; |
29 | 32 | import org.springframework.tests.sample.beans.TestBean;
|
30 | 33 |
|
31 | 34 | import static org.junit.Assert.*;
|
@@ -76,6 +79,20 @@ public void testNotNullConstraintAfterInitialization() {
|
76 | 79 | ac.close();
|
77 | 80 | }
|
78 | 81 |
|
| 82 | + @Test |
| 83 | + public void testNotNullConstraintAfterInitializationWithProxy() { |
| 84 | + GenericApplicationContext ac = new GenericApplicationContext(); |
| 85 | + RootBeanDefinition bvpp = new RootBeanDefinition(BeanValidationPostProcessor.class); |
| 86 | + bvpp.getPropertyValues().add("afterInitialization", true); |
| 87 | + ac.registerBeanDefinition("bvpp", bvpp); |
| 88 | + ac.registerBeanDefinition("capp", new RootBeanDefinition(CommonAnnotationBeanPostProcessor.class)); |
| 89 | + ac.registerBeanDefinition("bean", new RootBeanDefinition(AfterInitConstraintBean.class)); |
| 90 | + ac.registerBeanDefinition("autoProxyCreator", new RootBeanDefinition(DefaultAdvisorAutoProxyCreator.class)); |
| 91 | + ac.registerBeanDefinition("asyncAdvisor", new RootBeanDefinition(AsyncAnnotationAdvisor.class)); |
| 92 | + ac.refresh(); |
| 93 | + ac.close(); |
| 94 | + } |
| 95 | + |
79 | 96 | @Test
|
80 | 97 | public void testSizeConstraint() {
|
81 | 98 | GenericApplicationContext ac = new GenericApplicationContext();
|
@@ -156,6 +173,10 @@ public void setTestBean(TestBean testBean) {
|
156 | 173 | public void init() {
|
157 | 174 | this.testBean = new TestBean();
|
158 | 175 | }
|
| 176 | + |
| 177 | + @Async |
| 178 | + void asyncMethod() { |
| 179 | + } |
159 | 180 | }
|
160 | 181 |
|
161 | 182 | }
|
0 commit comments