Java Code Examples for org.springframework.context.support.ClassPathXmlApplicationContext#addApplicationListener()

The following examples show how to use org.springframework.context.support.ClassPathXmlApplicationContext#addApplicationListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringContainer.java    From dubbo-2.6.5 with Apache License 2.0 5 votes vote down vote up
@Override
public void start() {
    String configPath = ConfigUtils.getProperty(SPRING_CONFIG);
    if (configPath == null || configPath.length() == 0) {
        configPath = DEFAULT_SPRING_CONFIG;
    }
    context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+"), false);
    context.addApplicationListener(new DubboApplicationListener());
    context.registerShutdownHook();
    context.refresh();
    context.start();
}
 
Example 2
Source File: DubboApplicationListenerTest.java    From dubbo-2.6.5 with Apache License 2.0 4 votes vote down vote up
private ClassPathXmlApplicationContext getApplicationContext(DubboShutdownHook hook, boolean registerHook) {
    DubboBootstrap bootstrap = new DubboBootstrap(registerHook, hook);
    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext();
    applicationContext.addApplicationListener(new DubboApplicationListener(bootstrap));
    return applicationContext;
}