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.
I got what you want to say.thanks.
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?
Joined: Nov 11, 2006
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.