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

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

Introduction

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

Prototype

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException 

Source Link

Document

#mergeProperties Merge , #convertProperties convert and #processProperties process properties against the given bean factory.

Usage

From source file:net.sourceforge.jabm.SimulationExperiment.java

/**
 * Initialise the model by constructing it from the bean factory
 * and then applying the parameter bindings specified by the properties
 * attribute using Spring's properties post-processing feature.
 *//*from ww w.  j ava2 s. c  om*/
public void initialise() {
    PropertyOverrideConfigurer configurer = new PropertyOverrideWithReferencesConfigurer();
    configurer.setProperties(properties);
    configurer.postProcessBeanFactory((ConfigurableListableBeanFactory) beanFactory);
    this.model = (SimulationController) beanFactory.getBean("simulationController");
}

From source file:net.sourceforge.jabm.init.RandomVariateInitialiser.java

@Override
public Simulation initialise(SimulationController simulationController) {
    this.eventScheduler = simulationController;
    java.util.Properties variateBindings = new java.util.Properties();
    for (String variable : expressionBindings.keySet()) {
        Number value = evaluate(expressionBindings.get(variable), variateBindings);
        variateBindings.put(variable, value + "");
        logger.info(variable + " = " + value);
        fireEvent(variable, value);//from   w w  w  .  j a v a2s  . c om
    }
    PropertyOverrideConfigurer configurer = new PropertyOverrideConfigurer();
    configurer.setProperties(variateBindings);
    configurer.setLocalOverride(true);
    configurer.postProcessBeanFactory(
            (ConfigurableListableBeanFactory) ((SpringSimulationController) simulationController)
                    .getBeanFactory());
    return super.initialise(simulationController);
}