Example usage for org.springframework.context.event SimpleApplicationEventMulticaster SimpleApplicationEventMulticaster

List of usage examples for org.springframework.context.event SimpleApplicationEventMulticaster SimpleApplicationEventMulticaster

Introduction

In this page you can find the example usage for org.springframework.context.event SimpleApplicationEventMulticaster SimpleApplicationEventMulticaster.

Prototype

public SimpleApplicationEventMulticaster(BeanFactory beanFactory) 

Source Link

Document

Create a new SimpleApplicationEventMulticaster for the given BeanFactory.

Usage

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

/**
 * Initialize the ApplicationEventMulticaster.
 * Uses SimpleApplicationEventMulticaster if none defined in the context.
 * @see org.springframework.context.event.SimpleApplicationEventMulticaster
 *//*from   w w  w  . j av a 2s  .  c  om*/
protected void initApplicationEventMulticaster() {
    ConfigurableListableBeanFactory beanFactory = getBeanFactory();
    if (beanFactory.containsLocalBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME)) {
        this.applicationEventMulticaster = beanFactory.getBean(APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
                ApplicationEventMulticaster.class);
        if (logger.isDebugEnabled()) {
            logger.debug("Using ApplicationEventMulticaster [" + this.applicationEventMulticaster + "]");
        }
    } else {
        this.applicationEventMulticaster = new SimpleApplicationEventMulticaster(beanFactory);
        beanFactory.registerSingleton(APPLICATION_EVENT_MULTICASTER_BEAN_NAME,
                this.applicationEventMulticaster);
        if (logger.isDebugEnabled()) {
            logger.debug("Unable to locate ApplicationEventMulticaster with name '"
                    + APPLICATION_EVENT_MULTICASTER_BEAN_NAME + "': using default ["
                    + this.applicationEventMulticaster + "]");
        }
    }
}