Spring 配置 web.xml (防止spring 内存溢出)

Posted lshan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Spring 配置 web.xml (防止spring 内存溢出)相关的知识,希望对你有一定的参考价值。

技术分享图片
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>
      <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
        /WEB-INF/classes/spring/spring-context.xml
        /WEB-INF/classes/spring/spring-security.xml
        </param-value>
        <description>contextConfigLocation configuration</description>
    </context-param>
    
    
    <context-param>
        <param-name>spring.profiles.active</param-name>
        <param-value>dev</param-value>
    </context-param>
    <context-param>
        <param-name>spring.profiles.default</param-name>
        <param-value>dev</param-value>
    </context-param>
    <context-param>
        <param-name>spring.liveBeansView.mbeanDomain</param-name>
        <param-value>dev</param-value>
    </context-param> 
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <!-- 防止spring内存溢出监听器 -->
    <listener>
        <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
    </listener>
    <!-- spring mvc servlet -->
    <servlet>
        <servlet-name>springMvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/classes/spring/spring-mvc.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>springMvc</servlet-name>
        <url-pattern>/ws/*</url-pattern>
    </servlet-mapping>
    
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    <!-- <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener> -->
    <!-- life,20171122,add MDC Filter. -->
    <!-- MDC Filter. It‘s used to put request message to MDC and later can get the request body content from MDC -->
    <filter>
        <filter-name>mdcInMessageFilter</filter-name>
        <filter-class>com.icil.edi.ws.common.filter.MDCInMessageFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>mdcInMessageFilter</filter-name>
        <url-pattern>/ws/*</url-pattern>
    </filter-mapping>
    <!-- load the log4j configure file -->
    <listener>   
         <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>  
    </listener>  
    <context-param>   
        <param-name>log4jConfigLocation</param-name>   
        <param-value>/WEB-INF/classes/log/log4j.properties</param-value>  
    </context-param> 

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>
View Code

 

以上是关于Spring 配置 web.xml (防止spring 内存溢出)的主要内容,如果未能解决你的问题,请参考以下文章

linux操作系统基础2

PHP 简介

Java基础(正式上课第二天)

Linux虚拟机里面安装VMware Tools增强工具

十五.jmeter FTP服务器连接

moon javaScript简介 第1章和 在HTML中使用javaScript第2章