If you cannot justify it yourself, it's probably not worth it. I agree with the others that you should not go for Spring just for the hell of it. But if you want to check what it can help you to achieve, check out this overview. This recent article may also interest you. [ November 12, 2007: Message edited by: Christophe Verre ]
The quickest way to create an instance of a class is to use "new" operator directly. You can apply some GOF patterns (Factory, Builder, ...) to organize code better.
The slowest way is to use Java reflection, which Spring uses.
Herman Schelti
Ranch Hand
Joined: Jul 17, 2006
Posts: 387
posted
0
hi S. Palanigounder,
can you tell us where Spring uses reflection, and at what cost compared to the faster methods you mention?
Herman
S. Palanigounder
Ranch Hand
Joined: Apr 03, 2003
Posts: 145
posted
0
When you define a class in applicationcontext.xml, something like:
How does Java create an instance of com.work.MyDAOImpl using the data in the xml file?
Herman Schelti
Ranch Hand
Joined: Jul 17, 2006
Posts: 387
posted
0
hi S. Palanigounder,
thanks for your reply.
But you did not answer my question about the performance cost of this, especially since Spring usually only has to create 1 instance of this class. Can you post some numbers?
Herman [ November 17, 2007: Message edited by: Herman Scheltinga ]
Yes, Spring uses reflection but not reflection facility of the JDK, AFAIK, it uses the open source counter part (I'm not sure which open source project), but it is performant.