How to get the invoker name in EJB interceptor's lifecycle event method

谁说胖子不能爱 提交于 2019-12-04 04:54:25

For lifecycle callbacks ctx.getMethod() returns null. This is documented for example here: http://docs.oracle.com/javaee/5/api/javax/interceptor/InvocationContext.html

That is so, because it is not your EJB, but container who calls lifecycle callback methods.

If you are interested about association between interceptor and bean it belongs to, doesn't ctx.getTarget() method serve your purpose?

On WebLogic server you can use this in postConstructor, etc, to get the EJB name:

ctx.getTarget().getClass().getSuperclass().getName();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!