本文整理汇总了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);
}
}