在Wildfly 11中部署我的test.war期间,我看到了几个警告:
09:45:32,714 WARN [org.jboss.weld.Validator] (MSC service thread 1-4) WELD-001478: Interceptor class org.apache.deltaspike.core.impl.throttling.ThrottledInterceptor is enabled for the application and for the bean archive test.war/WEB-INF/lib/deltaspike-core-impl-1.8.1.jar. It will only be invoked in the @Priority part of the chain.
09:45:32,714 WARN [org.jboss.weld.Validator] (MSC service thread 1-4) WELD-001478: Interceptor class org.apache.deltaspike.core.impl.lock.LockedInterceptor is enabled for the application and for the bean archive test.war/WEB-INF/lib/deltaspike-core-impl-1.8.1.jar. It will only be invoked in the @Priority part of the chain.
09:45:32,715 WARN [org.jboss.weld.Validator] (MSC service thread 1-4) WELD-001478: Interceptor class org.apache.deltaspike.core.impl.future.FutureableInterceptor is enabled for the application and for the bean archive test.war/WEB-INF/lib/deltaspike-core-impl-1.8.1.jar. It will only be invoked in the @Priority part of the chain.
09:45:32,722 WARN [org.jboss.weld.Validator] (MSC service thread 1-4) WELD-001478: Interceptor class org.apache.deltaspike.jpa.impl.transaction.TransactionalInterceptor is enabled for the application and for the bean archive test.war/WEB-INF/lib/deltaspike-jpa-module-impl-1.8.1.jar. It will only be invoked in the @Priority part of the chain.
09:45:32,728 WARN [org.jboss.weld.Validator] (MSC service thread 1-4) WELD-001478: Interceptor class org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor is enabled for the application and for the bean archive test.war/WEB-INF/lib/deltaspike-proxy-module-api-1.8.1.jar. It will only be invoked in the @Priority part of the
这似乎是因为在我的test.war中的每个beans.xml现有deltaspike jar中都存在一些拦截器,例如对于deltaspike-core-impl-1.8.1.jar:
<class>org.apache.deltaspike.core.impl.throttling.ThrottledInterceptor</class>
<class>org.apache.deltaspike.core.impl.lock.LockedInterceptor</class>
<class>org.apache.deltaspike.core.impl.future.FutureableInterceptor</class>
是否可以从beans.xml中删除拦截器而不会造成危害?
在Wildfly 11中使用了CDI 1.2,我认为不再需要在beans.xml中显式列出拦截器。
至少似乎存在一些(小(问题,deltaspike开发人员应该对此进行调查?
这是DeltaSpike令人讨厌的黑色魔法-他们试图保持CDI 1.0的兼容性,这意味着他们不能使用@Priority
(稍后推出的CDI 1.1(作为在全球启用拦截器/装饰器/替代品的手段。为了使其工作,他们必须在JAR中包含一个beans.xml
,并在每个归档的基础上启用它。
但这还不是全部,他们通过使用一个扩展来绕过@Priority
限制,该扩展将他们所有的拦截器提升为全局启用的拦截器(例如,,就好像他们有@Priority
一样(。
现在,我不确定你是否可以删除它——你可以很容易地尝试看看它们是否仍然有效。但我不会碰它,因为DS在这方面似乎很脆弱。
至于Weld警告-这是非常无害的,Weld只是告诉你,在处理所有拦截器时:
- 它在
beans.xml
中找到的那些(每个bean归档启用( - 它通过扫描类路径识别的那些;查找
@Interceptor
+@Priority
(全局启用( - 以及最终通过扩展启用的(全局启用(
它发现一些拦截器是双向启用的,尽管如此,它们只会被调用一次。
总之,你不需要做任何事情,它应该仍然对你有效。