Tuesday, 20 August 2013

Spring Annotations when java file is compiled

Spring Annotations when java file is compiled

I started learning spring today and i have a question regarding what
happens to the annotations when java files with annotations is compiled ?.
The reason i am asking this is because of the fundamental difference i see
when we choose to use the xml approach vs the annotations approach , and
what i think is the philosophy of spring. The way i understand is spring
says that all your java classes can be simple pojo's and all the spring
related config should be kept independent (Like xml file.)
In case of developing spring application using xml *.java files have no
idea about spring container and are compiled in to .class without any
spring related dependencies.
But now when we annotate the .java file and the file is compiled the
compiled file now has all spring related dependencies hard baked in to it
and no longer are your classes simple pojo's.
Is this correct ? I am not sure if i am missing some thing here.

No comments:

Post a Comment