tag:robotlegs.tenderapp.com,2009-10-18:/discussions/questions/595-is-the-inject-metadata-really-neededRobotlegs: Discussion 2018-10-18T16:35:29Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/82151572011-06-27T19:05:35Z2011-06-27T19:05:36ZIs the Inject metadata really needed<div><p>I came across this <a href=
"http://joelhooks.com/2010/06/16/do-you-need-metadata-as3-robotlegs/">
article</a> from Joel Hooks today, looks like it was written about
a year ago and if I am reading it correctly, it looks as if the
inject meta tag is not necessary? does this mean I can just use</p>
<p><code>private var _model:Model = new Model();</code></p>
<p>instead of</p>
<p><code>[Inject] public var model:Model;</code></p></div>Joetag:robotlegs.tenderapp.com,2009-10-18:Comment/82151572011-06-27T20:22:44Z2011-06-27T20:22:44ZIs the Inject metadata really needed<div><p>Hi Joe,</p>
<p>You little misunderstood the article. It was about too many
different metatags across frameworks, also promoting Robotlegs as a
framework that only needs one metatag [Inject]. So to use it
correctly always use [Inject] metatag:</p>
<pre>
<code>[Inject] public var model:Model;</code>
</pre>
<p>If you use your first case you always get new Model instance and
then no chance to share the same instance in your context.</p>
<p>Cheers,<br>
Michal</p></div>Michal Wroblewskitag:robotlegs.tenderapp.com,2009-10-18:Comment/82151572011-06-28T07:29:45Z2011-06-28T07:29:45ZIs the Inject metadata really needed<div><p>Actually the inject metadata is not necessary, but obviously you
need to inform the injector somehow where injections are needed,
therefore you can pass a XML string to the constructor describing
all the injection points.<br>
See "XML configuration of injection points" at<br>
<a href=
"https://github.com/tschneidereit/SwiftSuspenders/blob/master/README.textile">
https://github.com/tschneidereit/SwiftSuspenders/blob/master/README...</a></p></div>creynderstag:robotlegs.tenderapp.com,2009-10-18:Comment/82151572011-06-29T08:28:26Z2011-06-29T08:28:26ZIs the Inject metadata really needed<div><p>Extra note: the example from Joel you're referring to uses
constructor injection, w/o inject metadata tags or the XML config
of the injections. If SS encounters constructor parameters it
automatically injects them with mapped values.</p></div>creynders