|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2024 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.
|
|
23 | 23 | import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
24 | 24 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
25 | 25 | import org.springframework.context.ApplicationContext;
|
| 26 | +import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor; |
26 | 27 | import org.springframework.context.support.GenericApplicationContext;
|
27 | 28 | import org.springframework.core.Conventions;
|
28 | 29 | import org.springframework.test.context.TestContext;
|
@@ -153,10 +154,14 @@ private void injectDependenciesInAotMode(TestContext testContext) throws Excepti
|
153 | 154 |
|
154 | 155 | Object bean = testContext.getTestInstance();
|
155 | 156 | Class<?> clazz = testContext.getTestClass();
|
| 157 | + |
156 | 158 | ConfigurableListableBeanFactory beanFactory = gac.getBeanFactory();
|
157 |
| - AutowiredAnnotationBeanPostProcessor beanPostProcessor = new AutowiredAnnotationBeanPostProcessor(); |
158 |
| - beanPostProcessor.setBeanFactory(beanFactory); |
159 |
| - beanPostProcessor.processInjection(bean); |
| 159 | + AutowiredAnnotationBeanPostProcessor autowiredAnnotationBpp = new AutowiredAnnotationBeanPostProcessor(); |
| 160 | + autowiredAnnotationBpp.setBeanFactory(beanFactory); |
| 161 | + autowiredAnnotationBpp.processInjection(bean); |
| 162 | + CommonAnnotationBeanPostProcessor commonAnnotationBpp = new CommonAnnotationBeanPostProcessor(); |
| 163 | + commonAnnotationBpp.setBeanFactory(beanFactory); |
| 164 | + commonAnnotationBpp.processInjection(bean); |
160 | 165 | beanFactory.initializeBean(bean, clazz.getName() + AutowireCapableBeanFactory.ORIGINAL_INSTANCE_SUFFIX);
|
161 | 166 | testContext.removeAttribute(REINJECT_DEPENDENCIES_ATTRIBUTE);
|
162 | 167 | }
|
|
0 commit comments