码迷,mamicode.com
首页 > 其他好文 > 详细

Dubbo服务提供者几种启动方式

时间:2017-05-23 11:21:35      阅读:569      评论:0      收藏:0      [点我收藏+]

标签:error:   sync   启动方式   cat   int   bsp   provider   容器   tar   

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 &

Dubbo服务提供者几种启动方式

标签:error:   sync   启动方式   cat   int   bsp   provider   容器   tar   

原文地址:http://www.cnblogs.com/Bruce3555/p/6892878.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!