`

org.springframework.web.util.IntrospectorCleanupListener

 
阅读更多

<listener>  

      <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>  

</listener>  

 

这是Introspector 缓存清除监听器

        Spring 提供了一个名为 org.springframework.web.util.IntrospectorCleanupListener 的监听器。它主要负责处理由 JavaBean Introspector 功能而引起的缓存泄露。IntrospectorCleanupListener 监听器在 Web 应用关闭的时会负责清除 JavaBean Introspector 的缓存,在 web.xml 中注册这个监听器可以保证在 Web 应用关闭的时候释放与其相关的 ClassLoader 的缓存和类引用。如果您使用了 JavaBean Introspector 分析应用中的类,Introspector 缓存会保留这些类的引用,结果在应用关闭的时候,这些类以及Web 应用相关的 ClassLoader 不能被垃圾回收。不幸的是,清除 Introspector 的唯一方式是刷新整个缓存,这是因为没法准确判断哪些是属于本 Web 应用的引用对象,哪些是属于其它 Web 应用的引用对象。所以删除被缓存的 Introspection 会导致将整个 JVM 所有应用的 Introspection 都删掉。需要注意的是,Spring 托管的 Bean 不需要使用这个监听器,因为 Spring 的 Introspection 所使用的缓存在分析完一个类之后会马上从 javaBean Introspector 缓存中清除掉,并将缓存保存在应用程序特定的 ClassLoader 中,所以它们一般不会导致内存资源泄露。但是一些类库和框架往往会产生这个问题。例如 Struts 和 Quartz 的 Introspector 的内存泄漏会导致整个的 Web 应用的 ClassLoader 不能进行垃圾回收。在 Web 应用关闭之后,您还会看到此应用的所有静态类引用,这个错误当然不是由这个类自身引起的。解决这个问题的方法很简单,您仅需在 web.xml 中配置 IntrospectorCleanupListener 监听器就可以了:

分享到:
评论

相关推荐

    spring-web-2.5.jar

    org.springframework.web.util.IntrospectorCleanupListener.class org.springframework.web.util.JavaScriptUtils.class org.springframework.web.util.Log4jConfigListener.class org.springframework.web.util....

    org.springframework.core.jar

    `org.springframework.util`则包含了一系列通用的工具类,如对象处理、集合操作、字符串处理等,极大地提升了开发效率。 2. **资源管理**:`org.springframework.core.io`包定义了资源接口,统一了文件、URL、输入/...

    org.springframework.web的jar包.zip

    在本篇文章中,我们将深入探讨`org.springframework.web`包中的关键概念,特别是`ServerEndpointExporter`类在WebSocket服务器端点中的作用。 首先,让我们了解`org.springframework.web`包的基本构成。这个包主要...

    Spring框架依赖jar包

    Spring框架依赖jar包,其中最小依赖包:org.springframework.core、org.springframework.context、org.springframework.beans、org.springframework.asm、org.springframework.expression、...

    org.springframework.expression-3.1.1.RELEASE.jar

    在`org.springframework.expression-3.1.1.RELEASE.jar`这个库中,包含了所有实现SpEL功能的类和接口,如`ExpressionParser`用于解析表达式,`EvaluationContext`用于提供上下文信息,以及`ValueExpression`表示一个...

    spring_MVC源码

    09. &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; 10. &lt;/listener&gt; 11. 12. &lt;servlet&gt; 13. &lt;servlet-name&gt;spring&lt;/servlet-name&gt; 14. &lt;servlet-class&gt;org.spring...

    spring4.0 API

    spring 4.0 未翻译java.lang....org.springframework.core.OrderComparator (implements java.util.Comparator) org.springframework.core.annotation.AnnotationAwareOrderComparator Annotation Type Hierarchy

    springboot 基础简易实例, maven项目

    import org.springframework.web.bind.annotation.RestController; // @RestController返回的是json @RestController public class HelloWorldController { // http://localhost:8080/hello 返回的是文本"Hello ...

    Spring项目中怎么配置log4j

    &lt;listener-class&gt;org.springframework.web.util.Log4jConfigListener ``` 以上就是Spring项目中配置log4j的基本步骤和关键知识点。通过合理配置,我们可以实现日志的高效管理和监控,从而提升开发和运维的效率。

    org.jbundle.util.osgi.wrapped.org.apache.http.client-4.1.2.jar

    org.jbundle.util.osgi.wrapped.org.apache.http.client-4.1.2.jar

    spring jdbctemplate 封裝

    import org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet; import org.springframework.jdbc.support.rowset.SqlRowSet; import org.springframework.jdbc.support.rowset.SqlRowSetMetaData; ...

    org.apache.commons.net.util.jar

    org.apache.commons.net.util.jar

    org.apache.http jar包

    下载HttpClient,解压,在Eclipse中导入所有JAR import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache....import org.apache.http.util.EntityUtils;

    org.apache.poi jar包

    org.apache.poi JAR包,解决个人的 import org.apache.commons.beanutils.PropertyUtilsBean;...import org.apache.poi.ss.util.CellRangeAddress; "The import org.apache.poi cannot be resolved"的问题

    spring2.5基于注解例子程序

    提供的jar包可能包括了Spring的核心模块(如context和beans),AOP模块,以及Web模块(如web和mvc)。这些jar包是运行和理解这个例子程序的基础。 综上所述,这个"spring2.5基于注解的例子程序"涵盖了Spring 2.5的...

    org.jasig.cas.client.util.CommonUtils

    予org.jasig.cas.client.util.CommonUtils 加入 public static void disableSSLVerification(){ try { // Create a trust manager that does not validate certificate chains TrustManager[] ...

    spring-framework.jar包

    这个"spring-framework.jar"包包含了Spring框架的所有组件和依赖,使得开发者在学习和使用Spring时无需逐一下载各个模块。这里我们将深入探讨Spring框架的核心知识点。 首先,Spring的核心理念是依赖注入...

    redis-lock-master.zip

    分布式锁与信号量 包含测试用例和实验的JAVA代码 ... ... ... import org.junit.Test;...import org.junit.runner.RunWith;...import org.springframework.beans....import java.util.concurrent.*; @RunWith(SpringRunner.cla

    基于spring boot 日志(logback)报错的解决方式

    错误信息:"No converter found capable of converting from type [java.lang.String] to type [java.util.Map&lt;java.lang.String,java.lang.String&gt;] org.springframework.boot.context.properties.bind....

    java head space.txt

    org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.OutOfMemoryError: Java heap space at org.springframework.web.servlet.DispatcherServlet....

Global site tag (gtag.js) - Google Analytics