Dorado 7 源码分析(一)SpringContextLoaderListener

根据Web.xml的加载顺序context-param->listener->filter->servlet   从SpringContextLoaderListener开始

Dorado7的Web服务是依托Spring MVC构建起来的(对Dorado源码分析将同时对Spring也进一步讲解)

public class SpringContextLoaderListener extends ContextLoaderListener {
        // Dorado 日志是基于apache.commons.logging管理的 至于后面配置log4j是由apache.commons.logging转向log4j
	private static final Log logger = LogFactory
			.getLog(SpringContextLoaderListener.class);
        /**DoradoLoader是一个单例
         *主要是服务启动时读取Dorado 配置文件,
         *处理Spring的配置文件
         *创建临时的ResourceLoader
         *创建临时存储目录
         *初始化WebContext等等
         *详细在后续DoradoLoader章节讲解
         */
	private DoradoLoader doradoLoader;

	public SpringContextLoaderListener() {
		doradoLoader = DoradoLoader.getInstance();
	}

	@Override
	protected void customizeContext(ServletContext servletContext,
			ConfigurableWebApplicationContext applicationContext) {
		try {
			doradoLoader.preload(servletContext, true);
			List<String> doradoContextLocations = doradoLoader
					.getContextLocations(false);
			String[] realResourcesPath = doradoLoader
					.getRealResourcesPath(doradoContextLocations);
			applicationContext.setConfigLocations(realResourcesPath);
		} catch (Exception e) {
			logger.error(e, e);
		}
	}
}

转载于:https://my.oschina.net/alextong/blog/97362

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值