• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Annotations Processing?

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How the Annotations are processed by the COntainer?

Are They mapped into DD?
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amit,

The DD is a deployment descriptor (an xml file) where you describe your deployment - just like web.xml in a web app.
Annotations are put directly in the code and can be loaded by a Java class (or Container) using the Reflection API.
They are just two ways of describing the same thing. If both are used, the DD takes precedence.

Does this answer your question?

MG
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess he was interested to know how and what the container does when it sees the Annotations.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mark Garland your answer is helpful to me.

Thanks.
 
Amit Suresh Pawar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi MG........

I got what you want to say.thanks.
But,
I know that Container reads the DD at start up. And DD also has the default values for their tags. So, if the annotations are in generated into java codes then at startup it needs to be replaced by values in the DD( or by default values ,if they are not initialized).

Finally, every time DD will replace values defined by annotations. Is it so?
I think no, then what is the correct flow?

Thank You....
 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amit,

As far as I know you are correct - the DD replaces (overrides) values from annotations.

This is useful as otherwise you'd need to recompile the source (which you may or may not have) to change the value in an annotation.

For example, let's say you defined a database connection string in an annotation and compiled the class and sent it to me.
Now, I may want to change that database connection string to something more applicable to my environment - but I couldn't do that without the source.
However, I *can* use a deployment descriptor to override your value, and for that I don't need the source.

Hope that helps,

MG
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic