Apr 4th, 2006, 01:00 PM
Are constructor/setter arguments initialized beans?
Is it guaranteed that when the Spring container calls the property setters or the constructor, then the objects passed in as arguments are already initialized? For example, if I have setFoo(Bar foo), then can setFoo be sure that foo is an initialized object, i.e. its afterPropertiesSet or custom init-method was already called? (The documentation only says that "the dependency is properly initialized before the dependent bean".)
Apr 5th, 2006, 02:47 AM
I can absolutely, 100% satisfaction guaranteed, indubitably confirm that the answer to your question is in the affirmative.
Evidently, replies have to be at least 10 characters in length; I originally just typed 'Yes'
Apr 5th, 2006, 02:53 PM
Thanks for the answer, I believe it to you without further proofs, still, I would like to ask if this rule is documented somewhere, or even is a consequence of anything in the documenation? If it isn't, it definitelly should be documented.
Apr 6th, 2006, 03:17 AM
Nice answer Rick !
Daniel, if you read the ref-doc carefully, then you would find an answer somewhere in the beginning of the chapter 3
Apr 6th, 2006, 03:41 AM
I have added an additional paragraph to the reference documentation (Chapter 3, in the section entitled 'Setting bean properties and collaborators') that clarifies the issue.
Said update will be included in the next release; thanks for spotting this.