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
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: 923
    
    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.


OCPJP 6(100 %) OCEWCD 6(91 %) OCPJBCD(93%)
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1524
    
  22

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: 923
    
    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 ?
 
Similar Threads
Question on @Resource Annotation
The place where we define Annotations inside the EJB Bean class
@Autowired, @Qualifier and @Resource annotation
Contradicting statements
Subclassing rules for Session beans