zoukankan      html  css  js  c++  java
  • Spring配置文件笔记

    启动服务器:
        <!-- Spring ApplicationContext配置文件的路径,可使用通配符. -->
        <!-- 多个路径用,号分隔此参数用于后面的Spring Context Loader -->
        <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath*:/applicationContext.xml</param-value>
        </context-param>
        <!-- Spring初始化容器类. -->
        <!-- 取配置文件里面定义的参数contextConfigLocation-->
        <!-- 若没有定义参数,则默认读取applicationContext.xml. -->
        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    以上内容会初始化容器类,实例化所有交给Spring的类。
    
    用户请求过滤类:
       <!-- 字符编码过滤. -->
        <filter>
            <filter-name>encodingFilter</filter-name>
            <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
            <init-param>
                <param-name>encoding</param-name>
                <param-value>UTF-8</param-value>
            </init-param>
            <init-param>
                <param-name>forceEncoding</param-name>
                <param-value>true</param-value>
            </init-param>
        </filter>
        <filter-mapping>
            <filter-name>encodingFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
    用户请求分发类: <!-- Spring分发的类,所有以.html结尾的页面均对应classpath*:dispatcher-servlet.xml配置文件. --> <servlet> <servlet-name>dispatcher-servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:dispatcher-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>dispatcher-servlet</servlet-name> <url-pattern>*.html</url-pattern> </servlet-mapping> 其他辅助类: <!-- Spring 刷新Introspector防止内存泄露 --> <listener> <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class> </listener> <!-- spring Security获得session生存周期事件 --> <listener> <listener-class> org.springframework.security.web.session.HttpSessionEventPublisher </listener-class> </listener>

      

    路慢慢其休远羲,吾将上下而求所
  • 相关阅读:
    1-13Object类之toString方法
    jvm源码解读--16 锁_开头
    jvm源码解读--16 cas 用法解析
    jvm源码解读--15 oop对象详解
    jvm源码解读--14 defNewGeneration.cpp gc标记复制之后,进行空间清理
    jvm源码解读--13 gc_root中的栈中oop的mark 和copy 过程分析
    Error: Could not find or load main class ***
    使用javah 给.class类编译jni_helloworld.h文件头
    jvm源码解读--12 invokspecial指令的解读
    jvm源码解读--11 ldc指令的解读
  • 原文地址:https://www.cnblogs.com/garinzhang/p/2690543.html
Copyright © 2011-2022 走看看