I like to know what is the main difference between EJB @EJB and @Resource annotation? In which case we have to go for @EJB and @resource
Specification states, regarding @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.
regarding @Resource(section 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.
Mentioned entries include: EJB reference, web service reference, resource manager connection factory reference, message destination reference, unit reference, persistence context reference, UserTransaction, CORBA ORB object, TimerService, EJBContext object
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With