dubbo学习笔记 六 dubbo-container

来源:互联网 发布:linux卸载httpd服务 编辑:程序博客网 时间:2024/06/05 20:15

这个模块比较简单,东西也不多,好写




看下SpringContainer吧,里面就是把META-INF/spring 下面的文件加载起来

public class SpringContainer implements Container {    private static final Logger logger = LoggerFactory.getLogger(SpringContainer.class);    public static final String SPRING_CONFIG = "dubbo.spring.config";        public static final String DEFAULT_SPRING_CONFIG = "classpath*:META-INF/spring/*.xml";    static ClassPathXmlApplicationContext context;        public static ClassPathXmlApplicationContext getContext() {return context;}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]+"));        context.start();    }    public void stop() {        try {            if (context != null) {                context.stop();                context.close();                context = null;            }        } catch (Throwable e) {            logger.error(e.getMessage(), e);        }    }}


0 0
原创粉丝点击