tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/235-minimalistic-injection-example-can-i-use-injection-in-main-application-at-startupRobotlegs: Discussion 2018-10-18T16:35:15Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/24800122010-08-05T15:18:05Z2010-08-05T15:18:05ZMinimalistic injection example - Can I use injection in main application at startup?<div><p>Hello!</p>
<p>There's a couple of problems there. Firstly, the context won't ever start up - this is because you aren't handing it a "contextView". It waits until this view is set and ready for action before it starts up. To remedy this, I would suggest creating your context as follows:</p>
<pre><code><fx:Declarations>
<test:TestContext contextView="{this}"/>
</fx:Declarations></code></pre>
<p>Secondly, Robotlegs (by default) doesn't inject into view components.</p>
<p>I would suggest taking a look at some of the demo apps (view-source enabled) to get a feel for the typical Robotlegs workflow:</p>
<p><a href="http://www.robotlegs.org/examples/">http://www.robotlegs.org/examples/</a></p>
<p>Hope that helps!</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/24800122010-08-06T09:41:54Z2010-08-17T12:05:44ZMinimalistic injection example - Can I use injection in main application at startup?<div><p>Thank you, Shaun!</p>
<p>Sorry about the obvious contextView mistake!<br />
The AppMediationDemo got me on the track, and also the HelloFlex demo - after stripping it down... (I find the HelloFlex project a little to complex for a complete neebee like me... An example with ONE view/mediator, ONE command etc would be great!)</p>
<p>When trying to get the grips with DI basics, I found my way to your SmartyPants, and also Samuel Williams Dewn library (<a href="http://github.com/sammyt/dawn#readme">http://github.com/sammyt/dawn#readme</a>). I'll continue my digging there...</p>
<p>Regards / Jonas</p></div>jonasnystag:robotlegs.tenderapp.com,2009-10-18:Comment/24800122010-08-06T11:47:29Z2010-08-06T11:47:29ZMinimalistic injection example - Can I use injection in main application at startup?<div><p>Coolio. Have you read through this:</p>
<p><a href="http://wiki.github.com/robotlegs/robotlegs-framework/robotlegs-internals">http://wiki.github.com/robotlegs/robotlegs-framework/robotlegs-inte...</a></p>
<p>Gives a nice introduction to Dependency Injection, and (hopefully) explains how Robotlegs is put together.</p></div>Shaun Smithtag:robotlegs.tenderapp.com,2009-10-18:Comment/24800122010-08-07T10:42:52Z2010-08-17T12:05:45ZMinimalistic injection example - Can I use injection in main application at startup?<div><p>Once the ball is rolling, it sometimes rolls in the right direction..! :-)<br />
Here's a walkthrough of my first working RL example, a simple MVC clock: <a href="http://cambiatablog.wordpress.com/2010/08/07/robotlegs-clock-example-walkthrough-1-views-mediators-and-context/">http://cambiatablog.wordpress.com/2010/08/07/robotlegs-clock-exampl...</a><br />
Thankx again, Shaun!<br />
</p></div>jonasnys