This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Well, to begin with, none of your teams knows spring too well. First, let me claim that it doesn't matter in 98% cases. Spring is a container which manages some/more/most of the boiler-plate code for you and nothing beyond that. When using any type of injection, when the bean its being created, all its dependencies would have to be pre-created. and that means, the lazy attribute doesn't help much as far as constructor/setter based injection is concerned. What matters most is whats written in constructor. If there's some time-consuming operation in constructor, any type of injection, will look similar. How much time it takes to create a normal object on a quad-core machine with 4/6/8GB of RAM, it is less than couple of milliseconds. On a typical production app, this time is minimal of the whole application life. So doesn't matter. Imagine a web application, which is expected to run 24*7 having initialization time of either 45 or 60 seconds. I don't think it matters in either case.

Now, why I said none of your teams know spring well, cause this is probably the most TRIVIAL of the issues to discuss when different teams are involved. When the WORK actually starts, there're better things to discuss and IDEALLY, teams should be looking forward to that rather.

Comment

Sorry, misunderstood I am, no way a constructor loaded with work can be better in any way whether or not constructor based inject is used.......the point is.....if constructor does minimal work then setter-based/constructor-based is equivalent and if it doesn't, even then it is equivalent, cause the constructor will take whatever time it requires......the point is to move ahead and try to create the other magic and/or pleasure using spring rather than getting stuck on what injection to prefer cause its anyway going to be less than 99.99% time of the overall application life.

Comment

Well we are .....Looking toward the magic... it's just that for a moment we said to our selves Hmmm which is better, is Spring doing something we have overlooked while focusing on the "magic". With all the Boiler Work going on its easy to overlook something which is why typos get into code.