在Websphere共享库中使用CDI

问题描述:

我们使用在Websphere管理控制台中定义的共享库在多个应用程序之间共享类。我想知道是否可以在这些类中使用CDI(上下文和依赖注入)?如果是这样,我是否只需要将bean.xml放入共享库中的jar中,或者还有其他步骤?

We use a shared library defined in the websphere admin console to share classes between several applications. I was wondering if it is possible to use CDI (Context and Dependecy Injection) in these classes? If so do I just need to put the beans.xml in the jar that is in the shared library, or are there further steps?

注意:我无法移动

不,共享库中包含的类是不视为CDI bean。只有应用程序本身包含的存档才可以考虑进行CDI。

No, classes included in a shared library are not considered as CDI beans. Only archives included in the application itself can be considered for CDI.