mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Align implementation of injectDependencies() with injectDependenciesInAotMode()
This commit is contained in:
+3
-2
@@ -151,10 +151,11 @@ public class DependencyInjectionTestExecutionListener extends AbstractTestExecut
|
||||
*/
|
||||
protected void injectDependencies(TestContext testContext) throws Exception {
|
||||
Object bean = testContext.getTestInstance();
|
||||
Class<?> clazz = testContext.getTestClass();
|
||||
String beanName = testContext.getTestClass().getName() + AutowireCapableBeanFactory.ORIGINAL_INSTANCE_SUFFIX;
|
||||
|
||||
AutowireCapableBeanFactory beanFactory = testContext.getApplicationContext().getAutowireCapableBeanFactory();
|
||||
beanFactory.autowireBeanProperties(bean, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
|
||||
beanFactory.initializeBean(bean, clazz.getName() + AutowireCapableBeanFactory.ORIGINAL_INSTANCE_SUFFIX);
|
||||
beanFactory.initializeBean(bean, beanName);
|
||||
testContext.removeAttribute(REINJECT_DEPENDENCIES_ATTRIBUTE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user