Need some help getting Autowired to work. I am fairly new to Flex, been playing with it for a couple of months and now starting a new project and would like to use Spring DI for it.
I have custom mxml component that extends form and I am trying to inject a CairngormEventDispatcher into the component. So what I have in the form is:
[Autowired(mode='byType')]
public var cairngormDispatcher:CairngormEventDispatcher;
In my app context I have:
<object
id="cairngormDispatcher"
class="com.adobe.cairngorm.control.CairngormEventD ispatcher"
factory-method="getInstance"/>
I have my project setup in flexmojos and eclipse builder, in flexmojos I've added:
<configuration>
<keepAs3Metadatas>
<keepAs3Metadata>Autowired</keepAs3Metadata>
<keepAs3Metadata>Bindable</keepAs3Metadata>
<keepAs3Metadata>Events</keepAs3Metadata>
</keepAs3Metadatas>
</configuration>
which results in: -compiler.keep-as3-metadata Autowired Bindable Events
in the compile output of flexmojos.
And in Eclipse builder I've also added: -keep-as3-metadata "Autowired"
I've tried building the application both ways and neither one does the Autowiring.
I know the app context is loaded correctly, I can do a getObject with "cairngormDispatcher" and it works. I am loading the app context on the applicationComplete event, but also have tried it with creationComplete and preinitialize.
Also I did a new FlexStageDefaultObjectSelector().approve on the custom component to verify that it would be considered for Autowiring.
So what could be wrong here? Is the compiler somehow just not picking up the
Autowired metadata? How can I investigate this further? Thanks in advance for any tips.


Reply With Quote
