tag:robotlegs.tenderapp.com,2009-10-18:/discussions/robotlegs-2/9558-maptovalue-doesnt-do-injectintoRobotlegs: Discussion 2014-05-26T14:26:16Ztag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-02-03T11:43:18Z2014-02-03T11:43:18Zmap().toValue() doesn't do injectInto<div><p>well :)<br>
you can always do</p>
<p>
injector.map(Foo).toValue(injector.instantiateUnmapped(Foo));</p>
<p>or simple</p>
<p>injector.map(Foo).asSignleton();</p></div>matejtag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-02-03T12:27:38Z2014-02-03T12:27:38Zmap().toValue() doesn't do injectInto<div><p>whell :)<br>
This is of course possible, but the code of config should be as
clean as possible, as I think. Maybe even better solution should
be:<br>
injector.map(Foo).asSignleton(true);<br>
where true means, that service should be auto initialized even if
not injected (for example for events observing).</p></div>lahmataja.pa4varatag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-02-03T14:20:25Z2014-02-03T14:20:25Zmap().toValue() doesn't do injectInto<div><p>I like that approach :)</p></div>matejtag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-02-04T16:10:07Z2014-02-04T16:13:23Zmap().toValue() doesn't do injectInto<div><p>I vote for those features, it will be handy imho.</p></div>ishaban.flashtag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-02-04T17:33:10Z2014-02-04T17:33:10Zmap().toValue() doesn't do injectInto<div><p>The question is, how to implement it in the correct way.
Actually all singeltons are created on demand. The question is, how
force instance creation as soon, as it's configured.</p></div>lahmataja.pa4varatag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-05-26T14:20:22Z2014-05-26T14:20:22Zmap().toValue() doesn't do injectInto<div><p>Please close topic, because solution implemented in
swiftsuspenders 2.2.1.</p></div>ishaban.flashtag:robotlegs.tenderapp.com,2009-10-18:Comment/314228242014-05-26T14:26:15Z2014-05-26T14:26:15Zmap().toValue() doesn't do injectInto<div><p>Cool</p></div>Shaun Smith