Example usage for org.springframework.context ConfigurableApplicationContext addBeanFactoryPostProcessor

List of usage examples for org.springframework.context ConfigurableApplicationContext addBeanFactoryPostProcessor

Introduction

In this page you can find the example usage for org.springframework.context ConfigurableApplicationContext addBeanFactoryPostProcessor.

Prototype

void addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor);

Source Link

Document

Add a new BeanFactoryPostProcessor that will get applied to the internal bean factory of this application context on refresh, before any of the bean definitions get evaluated.

Usage

From source file:org.springframework.boot.context.config.ConfigFileApplicationListener.java

/**
 * Add appropriate post-processors to post-configure the property-sources.
 * @param context the context to configure
 *///  w w  w. ja v  a 2s . c  om
protected void addPostProcessors(ConfigurableApplicationContext context) {
    context.addBeanFactoryPostProcessor(new PropertySourceOrderingPostProcessor(context));
}

From source file:org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer.java

@Override
public void initialize(ConfigurableApplicationContext context) {
    context.addBeanFactoryPostProcessor(new ConfigurationWarningsPostProcessor(getChecks()));
}

From source file:org.springframework.migrationanalyzer.commandline.AbstractMigrationAnalysis.java

final void run(String[] args) {
    CommandLine commandLine = null;//  ww  w .j a  v  a  2 s.  com
    try {
        commandLine = new PosixParser().parse(OPTIONS, args);
        String outputType = commandLine.getOptionValue(OptionsFactory.OPTION_KEY_OUTPUT_TYPE);
        String outputPath = commandLine.getOptionValue(OptionsFactory.OPTION_KEY_OUTPUT_PATH);
        String[] excludes = commandLine.getOptionValues(OptionsFactory.OPTION_KEY_EXCLUDE);

        String inputPath = getInputPath(commandLine);

        try {
            ConfigurableApplicationContext applicationContext = getApplicationContext();
            applicationContext.addBeanFactoryPostProcessor(new ConfigurationRegisteringBeanFactoryPostProcessor(
                    new Configuration(inputPath, outputPath, outputType, excludes)));
            applicationContext.refresh();
            applicationContext.getBean(MigrationAnalysisExecutor.class).execute();
        } catch (RuntimeException re) {
            this.logger.error("A failure occurred. Please see earlier output for details.");
            exit(-1);
        }
    } catch (ParseException e) {
        displayUsage();
        exit(-1);
    }
}

From source file:org.springframework.xd.dirt.plugins.stream.StreamPlugin.java

@Override
public void preProcessSharedContext(ConfigurableApplicationContext context) {
    context.addBeanFactoryPostProcessor(new BeanDefinitionAddingPostProcessor(context.getEnvironment(),
            new ClassPathResource(MESSAGE_BUS)));
}

From source file:org.springframework.xd.module.AbstractPlugin.java

private void addBeanFactoryPostProcessors(ConfigurableApplicationContext context, String... paths) {
    for (String path : paths) {
        context.addBeanFactoryPostProcessor(
                new BeanDefinitionAddingPostProcessor(context.getEnvironment(), new ClassPathResource(path)));
    }/*from   w w w.  jav a  2s . c o m*/
}