Announcement Announcement Module
Collapse
No announcement yet.
Multiple contexts, stage wiring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple contexts, stage wiring

    Hi,

    i have a question. I'm having 2 FlexXMLApplicationContexts in a main application:
    • bootstrapContext: setting up logginglevel, loggingtargets
    • applicationContext: business objects

    So first the boostrapContext is loaded and then the applicationContext is created and loaded. In that scenario i have logging in the way i want and can monitor the application context loading and processing.

    This all works fine, but if i want to autowire stage components things break. After debugging and some breakpoints i noticed that the DefaultAutoWireProcessor is only using the bootstrapContext to look up definitions. Apparently the first created context is the one used by the DefaultAutoWireProcessor. Is that correct?

    the question: How can i make sure the AutoWiring of stage components is using the applicationContext (which is created and loaded later) instead of the bootstrapContext?

    I mean is should be possible to use 2 application constexts, and use the last loaded one for stage wiring, right?

    BTW when i remove the bootstrapContext alltogether everything works fine, but don't want to do that ;-)

    cheers,

    Arnoud

  • #2
    workarounfd found bu still interested

    Hi all,

    i found a workaround:
    • Just use 1 applicationContext,
    • load boostrap.xml,
    • addListener complete --> bootstrapCompleteHandler
    • in bootstrapCompleteHandler set logging settings
    • in bootstrapCompleteHandler remove bootstrapCompleteHandler as listener to the complete event,
    • in bootstrapCompleteHandler addListener complete --> contextCompleteHandler
    • in bootstrapCompleteHandler add config locations of the xml files with business objects to the applicationContext.
    • in bootstrapCompleteHandler call aplicationContext.load(); to load the remaining config.xml files

    still interested in the first question though! How to set an application context as the one to be used a the definitions container for stage wiring processing.

    arnoud

    Comment


    • #3
      alrighty...

      Hey there,

      right now the stagewiring/stage processing pipleline is still in a state of flux, so it's gonna change a bit before the v0.9 release.
      Biggest change probably is that in v0.9 stagewiring will be OFF by default. Right now the FlexXMLApplicationContext creates a stagewiring processor by default, in the upcoming release this won't be the case.
      So, in the upcoming release it would be simple: Create a context for the bootstrap config, load and execute. Then create the second context for the business objects and declare a stagewiring processor in that same configuration.
      (If you need objects from the bootstrap config you can set the bootstrap context as your parent context for the business objects).

      If you're using the current trunk I guess what you could do is create the bootstrap configuration and after the load() has finished call the removeAutowiringStageProcessor() method. After that the bussiness context ought to perform the stagewiring.

      hope this helps,

      cheers,

      Roland

      Comment


      • #4
        thanx!

        Hi Roland,

        thanx for the info!

        i think that setting the stage wiring off by default in v0.9 is a good choice.

        For example we are using SAS (to configure the app externally) with Mate right now in which case it makes a lot of sense.

        cheers,

        Arnoud

        Comment

        Working...
        X