setter vs constructor injection spring
Posted on 2011-05-04
I was reading folowing lines and I did not understand clearly.
Goood yardstick to go
by is the clarity of your Spring configuration file. For instance, if you are creating
a bean that has only one mandatory property (such as a DAO object as its Data-
Source), constructor injection would probably be a good choice. on the other
hand, if you have a bean that has multiple, optional properties (such as the Data-
Source itself), setter injection would be more appropriate.
Any ideas, resources,sample code,links, highly appreciated. thanks in advance.