Package org.mokai.boot

Source Code of org.mokai.boot.Main

package org.mokai.boot;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
* Boots the gateway using Spring configuration files.
*
* @author German Escobar
*/
public final class Main {

  private static Logger log = LoggerFactory.getLogger(Main.class);

  /**
   * This class shouldn't be instantiated.
   */
  private Main() {}

  public static void main(String[] args) {
    // start spring context
    String[] configLocations = new String[] {
        "conf/core-context.xml", "conf/jogger-context.xml", "conf/admin-console-context.xml"
    };

    final ConfigurableApplicationContext springContext = new FileSystemXmlApplicationContext(configLocations);

    // add a shutdown hook to close spring context
    Runtime.getRuntime().addShutdownHook(new Thread() {
      public void run() {
        log.info("stopping spring context ... ");
        springContext.stop();
        springContext.close();
        log.info("<< spring context stopped >>");
      }
    });
  }

}
TOP

Related Classes of org.mokai.boot.Main

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.