zoukankan      html  css  js  c++  java
  • spring: 一些基本配置也许只有自己能够读懂

    web.xml
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/daoContext.xml /WEB-INF/applicationContext.xml</param-value>
    </context-param>

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

    <!-- or use the ContextLoaderServlet instead of the above listener
    <servlet>
    <servlet-name>context</servlet-name>
    <servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    -->

    监听器首先检查contextConfigLocation参数,如果它不存在,它将使用/WEB-INF/applicationContext.xml作为默认值。如果已存在,它将使用分隔符(逗号、冒号或空格)将字符串分解成应用上下文件位置路径。可以支持ant-风格的路径模式,如/WEB-INF/*Context.xml(WEB-INF文件夹下所有以"Context.xml"结尾的文件)。或者/WEB-INF/**/*Context.xml(WEB-INF文件夹及子文件夹下的以"Context.xml"结尾的文件)。

    ContextLoaderServletContextLoaderListener一样使用'contextConfigLocation'参数。

    Resource strings

    前缀例子说明

    classpath:

    classpath:com/myapp/config.xml

    从classpath中加载。

    file:

    file:/data/config.xml

    作为 URL 从文件系统中加载。

    http:

    http://myserver/logo.png

    作为 URL 加载。

    (none)

    /data/config.xml

    根据 ApplicationContext 进行判断。

    forward.molly.宝儿 独自行走
  • 相关阅读:
    oracle11g windows客户端安装
    leetcode做题总结
    后端工程师都应该知道的最佳实践
    阿里云ubuntu下nginx部署上线后报错问题
    漫谈逆向工程
    RPC远程过程调用(Remote Procedure Call)
    stub和proxy使用初衷
    vue如何绑定多个class style
    简单又好看的背景 , 代码实现方格背景
    使用C#.NET调用ICU进行编码检测和编码转换
  • 原文地址:https://www.cnblogs.com/forward/p/1820397.html
Copyright © 2011-2022 走看看