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();
}