zoukankan      html  css  js  c++  java
  • Spring加载配置文件的3种方法

    1方法(web.xml)
    <web-app>
       <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>/WEB-INF/applicationContext-*.xml</param-value>
       </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
    </web-app>
    2方法(web.xml)
    <web-app>
       <context-param>
          <param-name>contextConfigLocation</param-name>
          <param-value>/WEB-INF/applicationContext-*.xml</param-value>
       </context-param>
       <servlet>
          <servlet-name>SpringContextServlet</servlet-name>
          <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
       </servlet>
    </web-app>
    3方法在(struts-config.xml)中加载
     <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
            <set-property property="contextConfigLocation" 
                value="/WEB-INF/applicationContext.xml,
                       /WEB-INF/action-servlet.xml"/>
     </plug-in>

    转自:http://weijie.blog.51cto.com/340746/66502  

  • 相关阅读:
    下拉框插件开发 (一)
    工厂模式 抽象工厂模式
    闭包 构建函数 简单工厂模式
    js继承
    浅谈js观察者模式
    浅谈js单例模式
    localstorage本地存储
    Vi 配置文件
    Vi Command
    我的Firs博客
  • 原文地址:https://www.cnblogs.com/kelin1314/p/1840650.html
Copyright © 2011-2022 走看看