The Container will scan the classes when they are deployed. It will probably use methods like Class#getAnnotation and Class#getAnnotations on the class, on its fields and on its methods. It does it once, then parses the DD and overrides any existing settings.
As Christophe explained. Java has a reflection API that allows to inspect class information at runtime.
SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
mahudees waran
Greenhorn
Joined: Dec 17, 2006
Posts: 28
posted
0
Thanks for your reply guys.
Christophe,
Do you mean that the container first reads the DD and then overrides the DD configurations according to the annotations in classes while loading them.Also loading the classes which does mean that, Every class in the application will be loaded while the server startup? where as in case of servlets the servlet class is loaded on the first request untill we specifically mention it to load while server startup using
Hong Anderson
Ranch Hand
Joined: Jul 05, 2005
Posts: 1936
posted
0
DD overrides annotations.
I don't know detail, but I guess container just read class metadata, not create instance of every class.
When use reflection API to inspect class metadata, we don't need to create an instance of class. Anyway, a class itself is some kind of instance, but you don't need to worry about that.