我想知道EJB @EJB和@Resource注释之间的主要区别是什么?在这种情况下,我们必须去@EJB和@resource 最佳答案 有关@EJB的规范说明:
The Bean Provider uses the EJB annotation to annotate a field or setter
property method of the bean class as a target for the injection of an
EJB reference. The reference may be to a session bean’s business
interface or to the local home interface or remote home interface of a
session bean or entity bean.
关于@Resource(第16.2.2节):
A field or method of a bean class may be annotated to request that an
entry from the bean’s environment be injected. Any of the types of
resources or other environment entries described in this chapter may
be injected.
提到的条目包括:EJB引用,Web服务引用,资源管理器连接工厂引用,消息目标引用,单元引用,持久性上下文引用,UserTransaction,CORBA ORB对象,TimerService,EJBContext对象