Injecting EJBs using @Inject in class library

拜拜、爱过 提交于 2019-12-05 19:53:36

If you fail to include a beans.xml in your application library, none of the components within it will be eligible for CDI injection, either as receiving injection points or as being injectable in to other components. When you added your beans.xml you made it so that your library could be injected into and its classes were now eligible to be injected using @Inject

It's a catch 22. The purpose of a library is that it has little outside dependency and has no knowledge of how its being used, so you wouldn't typically have CDI related code in it.

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