@Intercepted Bean <!-?->是否要插入合法的类型和限定符对?

时间:2018-12-13 23:18:56

标签: cdi openwebbeans cdi-2.0

我正在通过标准CDI 2.0(SE)使用Narayana transaction engine。一切都可以在Weld上正常运行,但是我从OpenWebBeans 2.0.8中得到了一个奇怪的异常,如下所述。

Narayana交易机制在其拦截器的基类中具有injection point declared like so

@Inject
@Intercepted
private Bean<?> interceptedBean;

在基于OpenWebBeans 2.0.8的CDI 2.0 SE应用程序即将发布时,我看到以下内容(为便于阅读,我添加了换行符):

org.apache.webbeans.exception.WebBeansDeploymentException: 
javax.enterprise.inject.UnsatisfiedResolutionException:
Api type [javax.enterprise.inject.spi.Bean] is not found with the qualifiers 
Qualifiers: [@javax.enterprise.inject.Intercepted(),@javax.inject.Named(value="interceptedBean")]
for injection into Field Injection Point, field name :  interceptedBean,
Bean Owner : [TransactionalInterceptorNotSupported, WebBeansType:INTERCEPTOR, Name:null, API Types:[java.lang.Object,com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase, [...and so on...]

这对我来说似乎很可疑。 usage of Intercepted in exactly this manner is explicitly documented in the CDI 2.0 documentation,所以我希望它在OpenWebBeans下可以正常工作。

但是,错误消息似乎表明OpenWebBeans已决定在此字段中隐式添加一个@Named限定符(正如您所看到的那样)。显然,由于CDI 2.0规范不要求(我不认为)必须给被拦截的bean命名,因此附加的限定符将导致失败。

我的问题是:此验证错误是否符合CDI 2.0规范?我问是因为符合规范对我非常重要;我已经知道我可以在这种情况下使用Weld,但是我想了解这是OpenWebBeans错误还是CDI规范的一个不清楚区域(不知道如何)。

0 个答案:

没有答案
相关问题