Announcement Announcement Module
No announcement yet.
Autowiring components, from a module, that are added to the application Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Autowiring components, from a module, that are added to the application


    I have a modular Flex application. My application has an applicationContext.xml and each module has its own moduleContext.xml.

    When initializing the application I set the modulePolicy to ignore:
    FlexStageProcessorRegistry.getInstance().modulePol icy = ModulePolicy.IGNORE;

    My modules extend from BasicSASModule. Once the module is added to the stage all components that are added to the module component correctly get autowired from the moduleContext.xml.

    Now, the thing that's giving me problems is that my module contains some dialogs. When I display those, I do not add them to the module component, but to the application:
    PopUpManager.addPopUp(myDialog, Application.application as DisplayObject);

    When the dialog gets autowired, it only looks for object definitions in applicationContext.xml and fails to load anything that's configured in moduleContext.xml. I can work around this by configuring everything in applicationContext.xml, but that kinda beats the purpose of using modules.

    So my question (phew, almost there): Is there a better way to deal with this? Should I add some boiler plate code to autowire the dialog myself using the appropriate context?

    Thanks for your help,


  • #2

    Hey there,

    sorry for the late reply, we've been a little crazy busy lately...

    As for your question. An application context is associated with a module, in order to have the autowiring be performed by the correct application context you need to set the module as the parent for a specified popup. Otherwise the stage wiring mechanism has no way to determine that a specific popup needs to be wired by a specific context.

    PopUpManager.addPopUp(myDialog, myModuleInstance);
    Hope that helps,




    • #3

      Hi Roland,

      Thanks for you reply. I can relate to crazy busy

      I tried using the module as parent for the dialog, but then autowiring still happens using the application's context instead of the module context. Debugging DefaultAutowireProcessor.autowire() shows that the objectFactory only contains objectDefinitions from the application's context and this error appears:

      23:55:04.810 [ERROR] org.springextensions.actionscript.ioc.autowire.Def aultAutowireProcessor Error while autowiring property null of object something: Can't find an autowired candidate: Unsatisfied dependency in object [null] for property [something]

      Kind regards,