File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Can't we have more than 1 @Resource annotation specified on bean class ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Can Watch "Can New topic
Author

Can't we have more than 1 @Resource annotation specified on bean class ?

gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

i specified 2 @Resource annotations on a bean class. the name attribute of both the resource were different but still eclipse gave an error that duplicate Resource annotation exists.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1711
    
  25

Hi,

Yes you can have more resources of a class. Just like defining more @EJB's on a class is done with @EJBs, multiple resource can be declared bij using @Resources, for example (from: Oracle EE5 tutorial):

Regards,
Frits
gurpeet singh
Ranch Hand

Joined: Apr 04, 2012
Posts: 924
    
    1

Thanks a tonne Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't we have more than 1 @Resource annotation specified on bean class ?