加个监听器:
DubboProtocol.getDubboProtocol().destroy();
/** * * 服务监听器 * * @author marker * Created by marker on 2016/12/27. */ public class DubboServiceListener implements ServletContextListener { /** 日志记录 */ private Logger logger = LoggerFactory.getLogger(DubboServiceListener.class); @Override public void contextInitialized(ServletContextEvent sce) { System.out.println("初始化"); } @Override public void contextDestroyed(ServletContextEvent sce) { logger.info("销毁dubbo实例中...."); DubboRegistryFactory.destroyAll(); DubboProtocol.getDubboProtocol().destroy(); logger.info("销毁dubbo服务完成!"); } }