Example usage for org.springframework.context.support GenericXmlApplicationContext load

List of usage examples for org.springframework.context.support GenericXmlApplicationContext load

Introduction

In this page you can find the example usage for org.springframework.context.support GenericXmlApplicationContext load.

Prototype

public void load(Class<?> relativeClass, String... resourceNames) 

Source Link

Document

Load bean definitions from the given XML resources.

Usage

From source file:org.objectrepository.MessageConsumerDaemon.java

public void init() {

    log.info("Startup service...");
    GenericXmlApplicationContext context = new GenericXmlApplicationContext();
    context.setValidating(false);// w w  w .j  ava2s. co m
    context.load("/META-INF/spring/application-context.xml", "META-INF/spring/dispatcher-servlet.xml");
    context.refresh();
    setContext(context);
    context.registerShutdownHook();

    final RejectedExecutionHandler rejectedExecutionHandler = context.getBean(RejectedExecutionHandler.class);
    for (Queue taskExecutor : taskExecutors) {
        taskExecutor.setRejectedExecutionHandler(rejectedExecutionHandler);
        taskExecutor.initialize();
        log.info("Initialized " + taskExecutor.getQueueName());
    }
}