Example usage for org.springframework.beans.factory.config BeanFactoryPostProcessor postProcessBeanFactory

List of usage examples for org.springframework.beans.factory.config BeanFactoryPostProcessor postProcessBeanFactory

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanFactoryPostProcessor postProcessBeanFactory.

Prototype

void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException;

Source Link

Document

Modify the application context's internal bean factory after its standard initialization.

Usage

From source file:com.github.persapiens.jsfboot.annotations.JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java

public void testRegisteredScopeView() {
    ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    BeanFactoryPostProcessor beanFactoryPostProcessor = new JsfCdiToSpringBeanFactoryPostProcessor();

    beanFactoryPostProcessor.postProcessBeanFactory(beanFactory);

    assertThat(beanFactory.getRegisteredScope("view")).isInstanceOf(ViewScope.class);
}

From source file:org.cloudfoundry.reconfiguration.spring.DataSourceCloudServiceBeanFactoryPostProcessor.java

@Override
protected void postReconfiguration(ConfigurableListableBeanFactory beanFactory) {
    for (BeanFactoryPostProcessor postProcessor : this.ormBeanFactoryPostProcessors) {
        postProcessor.postProcessBeanFactory(beanFactory);
    }//from   w ww.  j  a  v a  2  s .c  o  m
}

From source file:org.joinfaces.annotations.JsfCdiToSpringApplicationBeanFactoryPostProcessorIT.java

@Test
public void testRegisteredScopeView() {
    ConfigurableListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    BeanFactoryPostProcessor beanFactoryPostProcessor = new JsfCdiToSpringBeanFactoryPostProcessor();

    beanFactoryPostProcessor.postProcessBeanFactory(beanFactory);

    assertThat(beanFactory.getRegisteredScope(JsfCdiToSpring.VIEW)).isInstanceOf(ViewScope.class);
}

From source file:com.mtgi.analytics.aop.config.ChainingBeanFactoryPostProcessor.java

public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    if (!targetFactory.equals(beanFactory)) {
        String[] bfpps = beanFactory.getBeanNamesForType(BeanFactoryPostProcessor.class, false, false);
        for (String name : bfpps) {
            BeanFactoryPostProcessor delegate = (BeanFactoryPostProcessor) beanFactory.getBean(name);
            if (isAllowed(delegate))
                delegate.postProcessBeanFactory(targetFactory);
        }/* w  w w.j  a  va  2 s  .c om*/
    }
}

From source file:org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.java

private void invokeOnChangeListener(Map event) {
    onChangeListener.setDelegate(this);
    onChangeListener.call(new Object[] { event });

    if (!(applicationContext instanceof GenericApplicationContext)) {
        return;/* www .j  a  v a 2 s.  co  m*/
    }

    // Apply any factory post processors in case the change listener has changed any
    // bean definitions (GRAILS-5763)
    GenericApplicationContext ctx = (GenericApplicationContext) applicationContext;
    ConfigurableListableBeanFactory beanFactory = ctx.getBeanFactory();
    for (BeanFactoryPostProcessor postProcessor : ctx.getBeanFactoryPostProcessors()) {
        try {
            postProcessor.postProcessBeanFactory(beanFactory);
        } catch (IllegalStateException e) {
            // post processor doesn't allow running again, just continue
        }
    }
}

From source file:org.springframework.context.support.PostProcessorRegistrationDelegate.java

/**
 * Invoke the given BeanFactoryPostProcessor beans.
 *///from  ww  w  .j  av a  2s .co  m
private static void invokeBeanFactoryPostProcessors(
        Collection<? extends BeanFactoryPostProcessor> postProcessors,
        ConfigurableListableBeanFactory beanFactory) {

    for (BeanFactoryPostProcessor postProcessor : postProcessors) {
        postProcessor.postProcessBeanFactory(beanFactory);
    }
}