Announcement Announcement Module
No announcement yet.
Function of IApplicationContextAware Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Function of IApplicationContextAware

    Hi List,

    we are working on a complex application which utilizes Modules and Moduleloading a lot. We use SpringActionscript-1.2-SNAPSHOT.

    On scenario could be:
    1. main application (application has own context) loads module1 (module1 has own context), application-context is merged into module1-context
    2. module1 loads module2 (module2 has own context), module1-context is merged into module2-context
    3. module2 loads module 3 (has own context), contexts are merged etc.

    To realise this I created a custom ModuleLoader (see one of my previous posts) which implements the IApplicationContextAware to get the context which is put as parent into the module context.
    In my real life application step 1. is no problem and works as expected.
    Step 2. (and step 3.) does not work.

    My suspicion is in step 2. not the module1-context is merged but the application-context and so the context inheritance is corrupted.

    How does IApplicationContextAware works exactly? Which context is filled automatically? Does IApplicationContextAware support modules?
    Where is a context bound to (to an application domain)?

    I would like to understand what I can do/check the correct context is set into my modules.

    Currently I have no example application but I can enhance the existing example project if necessary.

    Any help is appreciated,

  • #2
    Hi List,

    I still have the problem the wrong application context is injected using IApplicationContextAware.

    You can find a running application including the problem in

    How to reproduce my error:
    1. load "Single Module Container"
    2. click "unload module" button
    3. click "load new module" button
    4. choose "Module which loads Submodule"
    5. click "load submodule" button

    You will cause the
    Error: Can't find an autowired candidate: Unsatisfied dependency in object [null] for property [demoObject]

    The demo object is defined in the spring context of InjectedModule3.

    The sources for this demo can be found in

    Please notice you need the patched flexmojos 3.6.1 ( or the upcoming flexmojos 3.9-SNAPSHOT for building with autowiring support.

    Do I use IApplicationContext in a wrong way, is my custom ModuleLoader buggy or is there a bug in SpringActionscript-1.2-SNAPSHOT?



    • #3

      after having no response during the weekend I decided yesterday to refactor my module loading / handling.

      Removing some sharedEvents was a success the correct context seems to be injected using IApplicationContextAware.

      But now in a situation like context1 is parent of context2 is parent of context3 SAS was not able while being in context3 to resolve a service defined in context1.

      The reason is the AbstractObjectFactory only searched in the parent of context3 (means in context2) for the service and didn't proceed with context1.

      I patched the AbstractObjectFactory (refer to ) and now my objects are resolved correctly.

      Unfortunately I'm not able to run the maven install process (exits with a not specified error) so I don't know if my changes break the buildprocess and I can't provide a patched version of spring-actionscript-core.

      Hopefully my patch is correct and the original spring-actionscript-core-1.2-SNAPSHOT can be patched soon.

      Nevertheless the running example application can be found in, my updated sources are in the public SVN.



      • #4

        Hey Christoph,

        sorry for not getting back at you as quickly as usual, weŽve all been mad busy with work and life in general so there has been very little time for Spring Actionscript lately (plus for me personally as3commons-bytecode has been eating up all of the spare time I can spend on opensource...)
        Your fix seems fine to me, IŽll probably tweak your implementation a little bit, but thank you very much for the fix!