您当前的位置: 首页 >  spring

SpringMVC项目中web.xml中的节点加载顺序问题

发布时间:2014-10-11 17:16:15 ,浏览量:0

SpringMVC项目中web.xml中的节点加载顺序问题,之前以为web.xml中就是一些配置信息,和节点的顺序没有关系,后来才发现初始化时的加载顺序是和节点的顺序相关的。

完整的web.xml文件内容:

contextConfigLocationclasspath*:/spring/*.xmlencodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8forceEncodingtrueencodingFilter/*authenticationFilterorg.springframework.web.filter.DelegatingFilterProxyauthenticationFilter/*authorizationFilterorg.springframework.web.filter.DelegatingFilterProxyauthorizationFilter/*com.auth.spring.listener.SpringLoaderListenercom.abc.mobile.web.MobileLoadercom.auth.listener.HttpSessionManagerorg.springframework.web.util.IntrospectorCleanupListenercom.abc.conference.context.RpcManagerActioncom.abc.conference.apis.Actiont1com.abc.base.web.init.BaseDataServlet1Action/public/Actionmiddlewarecom.abc.mobile.web.ActionProxymiddleware/public/middleware
springmvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath*:/springmvc-servlet.xml1springmvc*.doServletLoaderServletLoadercom.abc.conference.context.ServletLoader1middlewareInitmiddlewareInitcom.abc.middleware.init.MiddlewareServletLoader2/index.jsp15
因为在Action中用到了一些静态变量,而这个静态变量是在BaseDataServlet中初始化的,所以如果
t1com.abc.base.web.init.BaseDataServlet1
配置节点,在Action:
Action/public/Action
节点之后的话,那调用静态变量的时候,静态变量的值就是Null,因为这时还没有初始化呢。
关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    105958博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0659s