List of usage examples for org.springframework.context.support StaticApplicationContext getAutowireCapableBeanFactory
@Override public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException
From source file:org.jboss.arquillian.spring.integration.enricher.AbstractSpringInjectionEnricher.java
/** * <p>Injects dependencies into the test case.</p> * * @param applicationContext the {@link org.springframework.context.ApplicationContext} * @param testCase the test case for which the beans will be injected *//*from w w w.j a v a 2 s .co m*/ private void injectDependencies(ApplicationContext applicationContext, Object testCase) { // for applications that do not contain Annotation post processors, create new // application context with those and create test class from that context StaticApplicationContext staticContext = new StaticApplicationContext(applicationContext); AnnotationConfigUtils.registerAnnotationConfigProcessors(staticContext); staticContext.refresh(); // retrieves the bean factory AutowireCapableBeanFactory beanFactory = staticContext.getAutowireCapableBeanFactory(); // injects all the members beanFactory.autowireBeanProperties(testCase, AutowireCapableBeanFactory.AUTOWIRE_NO, false); // initialize the bean beanFactory.initializeBean(testCase, testCase.getClass().getName()); }