dubbo main启动,源码流程分析

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-21 11:28   52   0
public static void main(String[] args){
        com.alibaba.dubbo.container.Main.main(args);
    }

如果args为空,则调用SpringContainer.start(),跟常规的spring容器启动方式一模一样,下面分析下start的实现逻辑。

1、从系统参数中读取“dubbo.spring.config”配置的配置文件路径,如果为空,则配置文件路径为classpath*:META-INF/spring/*.xml。

2、spring容器启动。

public void start() {
        String configPath = ConfigUtils.getProperty(SPRING_CONFIG);
        if (configPath == null || configPath.length() == 0) {
            configPath = DEFAULT_SPRING_CONFIG;
        }
        context = new ClassPathXmlApplicationContext(configPath.split("[,\\s]+"), false);
        context.addApplicationListener(new DubboApplicationListener());
        context.registerShutdownHook();
        context.refresh();
        context.start();
    }

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP