问答详情
源自:3-2 引入相应配置文件-SSH环境搭建

不能读取applicationConetext.xml文件?

Action、service类中以及struts.xml中都不能得到spring创建的bean,为什么

提问者:weibo_小宝宝囍_0 2016-12-30 14:45

个回答

  • 曲中殇
    2016-12-31 17:48:48
    已采纳

    web.xml中要如下配置Spring:

    <!-- Spring框架核心监听器 -->

      <listener>  

        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>  

     </listener>  

    <context-param>  

    <param-name>contextConfigLocation</param-name>    

    <param-value>classpath:applicationContext.xml  

    </param-value>    

    </context-param>