What's the best (or recommended way) to use Spring configured objects in an MXML component? For example, if I have some panels that need IoC configured objects such as services and business logic, should I configure those panels in the IoC as well? Or have a way for Panels to get a reference to the ApplicationContext so they can get them via getObject()? It would seem as if the second methodology would add some undesirable coupling. But trying to configure the panels via the IoC seems to come at a cost of losing much of the conveniences offered by MXML of quick coding and a more "visual" coding structure that allows you to easily see component nesting.
For example, say I have a TabNavigator that loads some panels. Each of those panels need IoC objects (services for example). In MXML using those panels is as easy as:
Adding another panel is a one line change. But to do this via the IoC, I need to add a property for each new tab, create a setter for it, add the setter to the IoC context configuration, and then add a line of code in the TabNavigator's init sequence to add the new panel as a child. And of course, in turn, each of those panels need to be configured through the IoC rather than simply coded in MXML along with a couple of getObject calls. Going ure IoC seems to be a lot of work when, in this case, the IoC doesn't seem to add any value in terms of being able to inject alternatives during testing, etc. Those benefits seem best geared towards more ActionScript orientated code like services and business logic.
<comp:PanelA id="panelA" />
<comp:PanelB id="panelB" />
<comp:PanelC id="panelC" />
Some advice and guidance would be appreciated. I've looked at the documentation, but am not finding anything on this subject, namely how to bridge the Spring Objects to MXML markup gap.