Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (23 sloc) 1.19 KB
<?xml version="1.0"?>
<mx:Application xmlns:mx="" creationComplete="creationCompleteHandler(event)">
import io.nucleo.inject.IInjector;
import io.nucleo.inject.createInjector;
import io.nucleo.inject.mojito.MojitoConfig;
import io.nucleo.inject.mojito.domain.Client;
import mx.resources.ResourceManager;
private var injector:IInjector;
private function creationCompleteHandler(event:FlexEvent):void {
// first we need our config. That is the place where our injection mappings are defined.
var config:MojitoConfig = new MojitoConfig();
// createInjector is a package level function used for convenience to get the injector
injector = createInjector(config);
// we take the root object out of the injector. The other objects will be injected just in time when they
// are used and needed.
var touristInBarcelona:Client = injector.getObject(Client);
// lets get a mojito ;-)