Example usage for org.springframework.beans.factory.xml XmlBeanDefinitionReader loadBeanDefinitions

List of usage examples for org.springframework.beans.factory.xml XmlBeanDefinitionReader loadBeanDefinitions

Introduction

In this page you can find the example usage for org.springframework.beans.factory.xml XmlBeanDefinitionReader loadBeanDefinitions.

Prototype

public int loadBeanDefinitions(InputSource inputSource, @Nullable String resourceDescription)
        throws BeanDefinitionStoreException 

Source Link

Document

Load bean definitions from the specified XML file.

Usage

From source file:com.obergner.hzserver.Main.java

void start() throws Exception {
    enableHangupSupport();/*from  www  . j  ava 2  s.  c  om*/

    this.serverInfo.logBootStart();

    final GenericApplicationContext ctx = new GenericApplicationContext();
    final XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(ctx);
    xmlReader.loadBeanDefinitions("classpath:META-INF/spring/hz-server-main-context.xml",
            "classpath*:META-INF/spring/hz-cache-context.xml");
    ctx.registerShutdownHook();
    ctx.addApplicationListener(new ApplicationListener<ContextRefreshedEvent>() {

        @Override
        public void onApplicationEvent(final ContextRefreshedEvent event) {
            Main.this.serverInfo.logBootCompleted();

        }
    });
    ctx.addApplicationListener(new ApplicationListener<ContextStoppedEvent>() {

        @Override
        public void onApplicationEvent(final ContextStoppedEvent event) {
            Main.this.serverInfo.logShutdownCompleted();
        }
    });
    ctx.refresh();
}