1.通过Spring容器启动
在spring配置文件加入
<import resource="dubbo-provider.xml" />
2.通过自定义Main函数
  try {
   ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
//spring-context.xml配置加入
/*
<import resource="dubbo-provider.xml" />
*/
   context.start();
  } catch (Exception e) {
   log.error("== DubboProvider context start error:",e);
  }
  synchronized (DubboProvider.class) {
   while (true) {
    try {
     DubboProvider.class.wait();
    } catch (InterruptedException e) {
     log.error("== synchronized error:",e);
    }
   }
  }
3.通过dubbo提供优雅关机Main函数 com.alibaba.dubbo.container.Main 注意通过这种方式打包启动jar 需要把项目依赖jar包放到一起这里通过Main配置依赖目录关系 启动命令 java -jar edu-service-user.jar &










