You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When 2 singleton injectee reference each other. A dead loop is caused during injection.
Here is an example:
class A
{
[Inject] B;
}
class B
{
[Inject] A;
}
class Foo
{
public function Foo()
{
var injector:Injector = new Injector();
injector.map(A).asSingleton();
injector.map(B).asSingleton();
injector.getInstance(A);
}
}
A fixed is adding a "postInstantiate" callback in Injector before "applyInjectionPoints" and assign the instance to _response in the callback.
SingletonProvider.as
private function createResponse(injector : Injector) : Object
{
if (_destroyed)
{
throw new InjectorError("Forbidden usage of unmapped singleton provider for type "
+ getQualifiedClassName(_responseType));
}
return injector.instantiateUnmapped(_responseType, postInstantiate);
}
private function postInstantiate(instance : Object)
{
_response = instance;
}
The text was updated successfully, but these errors were encountered:
When 2 singleton injectee reference each other. A dead loop is caused during injection.
Here is an example:
class A
{
[Inject] B;
}
class B
{
[Inject] A;
}
class Foo
{
public function Foo()
{
var injector:Injector = new Injector();
injector.map(A).asSingleton();
injector.map(B).asSingleton();
injector.getInstance(A);
}
}
A fixed is adding a "postInstantiate" callback in Injector before "applyInjectionPoints" and assign the instance to _response in the callback.
SingletonProvider.as
The text was updated successfully, but these errors were encountered: