Aug 25th, 2009, 05:26 AM
init methods before properties set?
I was just wondering if an init method specified on an object should occur after all properties have been set on all other objects in the ApplicationContext (as in the Java Spring)
as an example I have two objects ...
... DownloadManager has a reference to ScheduleManager, and in its setter adds a listener for when a Schedule is downloaded, and a schedule is first downloaded (or loaded from a file synchronously) in the ScheduleManager init method
So I would expect things to happen in this order
- DownloadManager / ScheduleManager constructed
- setScheduleManager called on DownloadManager
- init called on ScheduleManager
But I can see it happening in the step 3 and then 2 order.
Just wondering if i'm on the right path thinking things should happen in this order.
Aug 25th, 2009, 01:10 PM
You are correct
You may try using the IInitiatingObject interface instead of an init method.
you need to implement
public void afterPropertiesSet():void