java 注册回调_java – WARN:无法注册销毁回调

15:11:14,676 WARN FacesRequestAttributes:121 – Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@1059fd6] for attribute ‘purchaseController’ because FacesRequestAttributes does not support such callbacks

这个警告消息在我的日志中出现很多.对于每个受管Bean,只要它到期.在给定的时间过后,因为我使用MyFaces乐团.

我已经在我的web.xml中定义了org.springframework.web.context.request.RequestContextListener,而且我的classpath中没有spring jar(即不是类加载问题)

FacesRequestAttribute的文档说:

NOTE: In contrast to ServletRequestAttributes,this variant does not support destruction callbacks for scoped attributes,neither for the request scope nor for the session scope. If you rely on such implicit destruction callbacks,consider defining a Spring RequestContextListener in your web.xml.

purchaseController实际上是一个简单的托管bean(不扩展任何只实现Serializable的),用@Controller注释.

UPDATE1:

@Scope(“request”)和@Scope(“session”)中的bean似乎受到影响.

所以我想知道这个警告是否对正确的流量构成任何危险.即如果真的需要这些回调.如果没有,我将跳过与lo4j配置的警告.

更新2:

我进一步挖了一下,似乎这只是有时候发生.如果使用监听器,则RequestContextHolder.currentRequestAttributes()返回ServletRequestAttributes,而不是FacesRequestAttributes.所以看来有时监听器不起作用,并且不会在RequestContextHolder中设置当前的属性.

更新3:

我为RequestContextListener打开了调试,这里是结果:

07:21:31,518 DEBUG RequestContextListener:69 - Bound request context to thread: org.apache.catalina.connector.RequestFacade@1190ae9

07:21:31,518 DEBUG RequestContextListener:89 - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@1190ae9

07:21:31,538 WARN FacesRequestAttributes:121 - Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@11aa152] for attribute 'org.apache.myfaces.orchestra.conversation.AccessScopeManager' because FacesRequestAttributes does not support such callbacks

07:21:31,541 WARN FacesRequestAttributes:121 - Could not register destruction callback [org.springframework.beans.factory.support.DisposableBeanAdapter@1552393] for attribute 'localeController' because FacesRequestAttributes does not support such callbacks

....and so on,other request and session beans

在尝试访问bean之前,请求被破坏.这很奇怪这可能是由于servlet容器实现侦听器处理的一个问题吗?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值