增加方式如下:
<!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--> <listener>
<listener-class>
org.springframework.web.util.IntrospectorCleanupListener
</listener-class>
</listener>
spring的说明如下:
Listener that flushes the JDK's JavaBeans Introspector
cache on web app shutdown. Register this listener in your web.xml
to guarantee proper release of the web application class loader and its loaded classes.
If the JavaBeans Introspector has been used to analyze application classes, the system-level Introspector cache will hold a hard reference to those classes. Consequently, those classes and the web application class loader will not be garbage-collected on web app shutdown! This listener performs proper cleanup, to allow for garbage collection to take effect.
Unfortunately, the only way to clean up the Introspector is to flush the entire cache, as there is no way to specifically determine the application's classes referenced there. This will remove cached introspection results for all other applications in the server too.
Note that this listener is not necessary when using Spring's beans infrastructure within the application, as Spring's own introspection results cache will immediately flush an analyzed class from the JavaBeans Introspector cache and only hold a cache within the application's own ClassLoader. Although Spring itself does not create JDK Introspector leaks, note that this listener should nevertheless be used in scenarios where the Spring framework classes themselves reside in a 'common' ClassLoader (such as the system ClassLoader). In such a scenario, this listener will properly clean up Spring's introspection cache.
Application classes hardly ever need to use the JavaBeans Introspector directly, so are normally not the cause of Introspector resource leaks. Rather, many libraries and frameworks do not clean up the Introspector: e.g. Struts and Quartz.
Note that a single such Introspector leak will cause the entire web app class loader to not get garbage collected! This has the consequence that you will see all the application's static class resources (like singletons) around after web app shutdown, which is not the fault of those classes!
This listener should be registered as the first one in web.xml
, before any application listeners such as Spring's ContextLoaderListener. This allows the listener to take full effect at the right time of the lifecycle.
其中JavaBeans Introspector是一个类,位置在Java.bean.Introspector,这个类的用途是发现java类是否符合javaBean规范,也就是这个类是不是javabean。具体用法可以参照jdk文档;
上面的意思就是,如果有的框架或者程序用到了JavaBeans Introspector了,那么就启用了一个系统级别的缓存,这个缓存会存放一些曾加载并分析过的javabean的引用,当web服务器关闭的时候,由于这个缓存中存放着这些javabean的引用,所以垃圾回收器不能对web容器中的javaBean对象进行回收,导致内存越来越大。
spring提供的org.springframework.web.util.IntrospectorCleanupListener就解决了这个问题,他会在web服务器停止的时候,清理一下这个Introspector缓存。使那些javabean能被垃圾回收器正确回收。
spring不会出现这种问题,因为spring在加载并分析完一个类之后会马上刷新JavaBeans Introspector缓存,这样就保证了spring不会出现这种内存泄漏的问题。
但是有很多程序和框架在使用了JavaBeans Introspector之后,都没有进行清理工作,比如quartz、struts;解决办法很简单,就是上面的那个配置。
相关推荐
ssh整合所需要的jar包,ssh整合所需要的jar包,ssh整合所需要的jar包,
SSH框架需要的jar包,hibernate,spring,structs所需要的都包含了
ssh框架集成开发所需要的所有的jar包,不用找了,这里全都有。
ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ssh shhs ssh ...
该资源包括了SSH框架中整合所需要的数据库Hibernate所需要的所有基本jar包的资源
javaweb开发中ssh框架需要的jar包,包含struts2,hibernate,spring以及mysql驱动的jar包
简单的SSH框架所需要的jar包,能够快速的上手SSH,进行代码的编写
ssh框架整合需要的 jar包
该压缩包中包括java搭建ssh所需要的jar包以及搭建ssh框架的步骤。
SSH整合完整的jar包
SSH需要的jar,ssh完整jar
ssh 需要的jar包汇总ssh 需要的jar包汇总ssh 需要的jar包汇总
ssh整合,hibernate5的整合,很简单,里面有包,
SSH中文帮助文档 ...觉得很实用.拿出来.给大家分享..希望对大家有用
ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ssh 框架 ...
ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh框架项目源码ssh...
ssh高级ssh高级ssh高级ssh高级ssh高级ssh高级ssh高级ssh高级
在ssh中加入jbpm工作流所需要的包 在ssh中加入jbpm工作流所需要的包 在ssh中加入jbpm工作流所需要的包 在ssh中加入jbpm工作流所需要的包
ssh框架需要的jar包,spring,struts,hibernate,下载解压即可用