Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Difference between @EJB and @Resource  RSS feed

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
Please differentiate between @EJB and @Resource

am not understanding this dependancy injection,

what do you mean by @Resource(name="abc")
 
Ranch Hand
Posts: 65
Firefox Browser Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@EJB is used to inject an EJB Remote/local interface. Whilst @Resource is what you would use to inject any resource from your "jndi:comp/env" environment. This could be a datasource, email connection, jms connectionfactory etc
 
shabarish vai
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Vignesh Murali Natarajan,
i have read that @EJB is not supported by and we need to explicitly do a loop up(only GlassFish servers support),what and where to configure this JNDI stuff's if am using jboss server.i want to know about this JNDI
 
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shabarish

AS the name said the @EJB is used only to inject beans. The resource is used to inject other resources (like EJBContext). But the most important aspect here is that the both @EJB and the @Resources are supported by all the application servers and both uses in background JNDI to locate the needed components.

Regards,
Mihai
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!