本文整理匯總了Java中org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory方法的典型用法代碼示例。如果您正苦於以下問題:Java BeanFactoryPostProcessor.postProcessBeanFactory方法的具體用法?Java BeanFactoryPostProcessor.postProcessBeanFactory怎麽用?Java BeanFactoryPostProcessor.postProcessBeanFactory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.config.BeanFactoryPostProcessor
的用法示例。
在下文中一共展示了BeanFactoryPostProcessor.postProcessBeanFactory方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testFactoryBeansWithAutowiring
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
@Test
public void testFactoryBeansWithAutowiring() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
assertNull(factory.getType("betaFactory"));
Alpha alpha = (Alpha) factory.getBean("alpha");
Beta beta = (Beta) factory.getBean("beta");
Gamma gamma = (Gamma) factory.getBean("gamma");
Gamma gamma2 = (Gamma) factory.getBean("gammaFactory");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
assertSame(gamma2, beta.getGamma());
assertEquals("yourName", beta.getName());
}
示例2: testFactoryBeansWithAutowiring
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
@Test
public void testFactoryBeansWithAutowiring() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
Alpha alpha = (Alpha) factory.getBean("alpha");
Beta beta = (Beta) factory.getBean("beta");
Gamma gamma = (Gamma) factory.getBean("gamma");
Gamma gamma2 = (Gamma) factory.getBean("gammaFactory");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
assertSame(gamma2, beta.getGamma());
assertEquals("yourName", beta.getName());
}
示例3: invokeBeanFactoryPostProcessors
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private static void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
示例4: testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
@Test
public void testFactoryBeansWithIntermediateFactoryBeanAutowiringFailure() throws Exception {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(WITH_AUTOWIRING_CONTEXT);
BeanFactoryPostProcessor ppc = (BeanFactoryPostProcessor) factory.getBean("propertyPlaceholderConfigurer");
ppc.postProcessBeanFactory(factory);
Beta beta = (Beta) factory.getBean("beta");
Alpha alpha = (Alpha) factory.getBean("alpha");
Gamma gamma = (Gamma) factory.getBean("gamma");
assertSame(beta, alpha.getBeta());
assertSame(gamma, beta.getGamma());
}
示例5: testRegisteredScopeView
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
@Test
public void testRegisteredScopeView() {
ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
BeanFactoryPostProcessor beanFactoryPostProcessor = ViewScopeAutoConfiguration.viewScopeConfigurer();
beanFactoryPostProcessor.postProcessBeanFactory(beanFactory);
assertThat(beanFactory.getRegisteredScope(ViewScope.SCOPE_VIEW))
.isInstanceOf(ViewScope.class);
}
示例6: invokeBeanFactoryPostProcessors
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
/**
* Invoke the given BeanFactoryPostProcessor beans.
*/
private void invokeBeanFactoryPostProcessors(
Collection<? extends BeanFactoryPostProcessor> postProcessors, ConfigurableListableBeanFactory beanFactory) {
for (BeanFactoryPostProcessor postProcessor : postProcessors) {
postProcessor.postProcessBeanFactory(beanFactory);
}
}
示例7: invokeBeanFactoryPostProcessors
import org.springframework.beans.factory.config.BeanFactoryPostProcessor; //導入方法依賴的package包/類
/**
* Invoke given post processors.
*
* @param beanFactory
* @param postProcessors
*/
private void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory, List postProcessors) {
for (Iterator it = postProcessors.iterator(); it.hasNext();) {
BeanFactoryPostProcessor postProcessor = (BeanFactoryPostProcessor) it.next();
postProcessor.postProcessBeanFactory(beanFactory);
}
}