Examples of postProcessBeanFactory()


Examples of org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory()

    beanFactory.registerBeanDefinition("factory", new RootBeanDefinition(LocalContainerEntityManagerFactoryBean.class));

    ConfigurableListableBeanFactory childFactory = new DefaultListableBeanFactory(beanFactory);

    BeanFactoryPostProcessor processor = new EntityManagerBeanDefinitionRegistrarPostProcessor();
    processor.postProcessBeanFactory(childFactory);

    assertThat(beanFactory.getBeanDefinitionCount(), is(2));
  }
}
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory()

  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");
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory()

  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());
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory()

   */
  protected void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory) {
    // Invoke factory processors registered with the context instance.
    for (Iterator it = getBeanFactoryPostProcessors().iterator(); it.hasNext();) {
      BeanFactoryPostProcessor factoryProcessor = (BeanFactoryPostProcessor) it.next();
      factoryProcessor.postProcessBeanFactory(beanFactory);
    }

    // Do not initialize FactoryBeans here: We need to leave all regular beans
    // uninitialized to let the bean factory post-processors apply to them!
    String[] postProcessorNames =
View Full Code Here

Examples of org.springframework.beans.factory.config.BeanFactoryPostProcessor.postProcessBeanFactory()

   * Invoke the given BeanFactoryPostProcessor beans.
   */
  private void invokeBeanFactoryPostProcessors(ConfigurableListableBeanFactory beanFactory, List postProcessors) {
    for (Iterator it = postProcessors.iterator(); it.hasNext();) {
      BeanFactoryPostProcessor postProcessor = (BeanFactoryPostProcessor) it.next();
      postProcessor.postProcessBeanFactory(beanFactory);
    }
  }

  /**
   * Instantiate and invoke all registered BeanPostProcessor beans,
View Full Code Here

Examples of org.springframework.beans.factory.config.CustomEditorConfigurer.postProcessBeanFactory()

                new FileSystemResource("./ch5/src/conf/pe/custom.xml"));

        CustomEditorConfigurer config = (CustomEditorConfigurer) factory
                .getBean("customEditorConfigurer");

        config.postProcessBeanFactory(factory);

        CustomEditorExample bean = (CustomEditorExample) factory
                .getBean("exampleBean");

        System.out.println(bean.getMatchCount());
View Full Code Here

Examples of org.springframework.beans.factory.config.CustomEditorConfigurer.postProcessBeanFactory()

    XmlBeanFactory beanFactory = new XmlBeanFactory(r);
   
    try {
      if (beanFactory.containsBean("customEditorConfigurer")) {
        CustomEditorConfigurer configurer = (CustomEditorConfigurer) beanFactory.getBean("customEditorConfigurer");   
        configurer.postProcessBeanFactory(beanFactory);
      }
    } catch (NoSuchBeanDefinitionException nsbde) {
      throw new RuntimeException(nsbde);
    }
View Full Code Here

Examples of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.postProcessBeanFactory()

        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        Properties properties = new Properties();
        properties.setProperty("staticResourceURL", getStaticResourceURL());
        cfg.setProperties(properties);
        // now actually do the replacement
        cfg.postProcessBeanFactory(applicationContext.getBeanFactory());       
        applicationContext.refresh();
    }
   
    private void invokeService() {       
        DummyInterface client = (DummyInterface) applicationContext.getBean("dummy-client");
View Full Code Here

Examples of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.postProcessBeanFactory()

        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        Properties properties = new Properties();
        properties.setProperty("staticResourceURL", getStaticResourceURL());
        cfg.setProperties(properties);
        // now actually do the replacement
        cfg.postProcessBeanFactory(applicationContext.getBeanFactory());       
        applicationContext.refresh();
    }
   
    private void invokeService() {       
        DummyInterface client = (DummyInterface) applicationContext.getBean("dummy-client");
View Full Code Here

Examples of org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.postProcessBeanFactory()

        PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
        Properties properties = new Properties();
        properties.setProperty("staticResourceURL", getStaticResourceURL());
        cfg.setProperties(properties);
        // now actually do the replacement
        cfg.postProcessBeanFactory(applicationContext.getBeanFactory());       
        applicationContext.refresh();
    }
   
    private void invokeService() {       
        DummyInterface client = (DummyInterface) applicationContext.getBean("dummy-client");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.