What is the difference between @Inject and @EJB

前端 未结 3 483
庸人自扰
庸人自扰 2020-12-08 07:10

I\'m currently learning the new Java EE 6 component models and am confused with the latest dependency injection mechanism. So here are my questions:

1) What is the d

3条回答
  •  庸人自扰
    2020-12-08 07:20

    1. @Inject is more general than EJB and is part of CDI specification. So if you want to use @Inject, you need an implementation of it in your server.

    2. For POJOs (not EJBs) you have to use @Inject.

提交回复
热议问题