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?
Note: I can't move away from using a shared library, as this would be too much refactoring work.
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.
来源:https://stackoverflow.com/questions/15199929/using-cdi-in-a-websphere-shared-library