aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Which is better when working with J2EE Beans? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Which is better when working with J2EE Beans?" Watch "Which is better when working with J2EE Beans?" New topic
Author

Which is better when working with J2EE Beans?

charlsy chuks
Ranch Hand

Joined: May 18, 2012
Posts: 79
Hi James,

I have written code that use annotations like the @Stateless etc. I sometimes wonder which to choose when coding-settings in the web cofig xml or would it be better to use annotations sometimes?
I'm tempted to think config xml files are nbetter since they can be changed after the web application has been deployed.

Cheers

Charles


































Paul Anilprem
Enthuware Software Support
Ranch Hand

Joined: Sep 23, 2000
Posts: 3296
    
    7
It is true that config files can be changed after a web app has been coded but many config items such as the one you mentioned (@Stateless) are closely tied to the code. If a bean is coded to be used as @Stateless, is there any point in changing its type to @Stateful in the deployment descriptor? It will most probably fail to work as expected. So some configuration items are better specified using annotations while others such as environment properties can be overridden using a DD.

HTH,
Paul.


Enthuware - Best Mock Exams and Questions for Oracle/Sun Java Certifications
Quality Guaranteed - Pass or Full Refund!
James X Peterson
Whizlabs Java Support
Ranch Hand

Joined: Feb 26, 2013
Posts: 158
Thanks Paul and Charles...

Generically speaking, with the launch of the Servlet specification 3.0, annotations were introduced. Deployment descriptors are still present and they are being used - but the use of annotations is encouraged to enable easier assembly and deployment. Writing huge chunks of DD elements can be cumbersome after a while.
Some elements can be defined by means of deployment descriptor web fragments and the others can be defined by means of annotations
charlsy chuks
Ranch Hand

Joined: May 18, 2012
Posts: 79
Thanks for the answers Paul and James.

I can really do with this information in the work I do. Most of Java SE is smooth. but issues arise when it comes to J2EE.


I'm grateful.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which is better when working with J2EE Beans?