Matters needing attention when the dubbo main function starts the spring project

 

 

The main thread opened by the main function cannot be stopped, otherwise the entire spring context will be closed (load the context file and open the context)

 

  while(true) {

        try {

Thread.sleep(100000000000L);

} catch (InterruptedException e) {}

        }

 

 

 

 

 

package com.houbank.incoming.service.main;

 

import java.io.IOException;

 

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**

 * 

 * <p>1. The main method of this class can be started directly during development, which is convenient for debugging

 * 2. You can also configure debug as configuration in the development tool and start the com.alibaba.dubbo.container.Main method</p>

 * @author houzhanshan

 * @version $Id: HbIncomingServiceMain.java, v 0.1 Jun 12, 2017 11:08:05 AM Exp $

 */

public class HbIncomingServiceMain {

    public static void main(String[] args) throws IOException {

 

//        System.setProperty("zookeeper.sasl.client","false");

 

        @SuppressWarnings("resource")

        ClassPathXmlApplicationContext  context = new ClassPathXmlApplicationContext("/META-INF/spring/applicationContext.xml");

        context.start();  

        System.out.println("dubbo server start");  

        while(true) {

        try {

Thread.sleep(100000000000L);

} catch (InterruptedException e) {}

        }

    }

 

}

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326058226&siteId=291194637