Error:Injector is missing a rule to handle injection into target

kristoferjoseph's Avatar


07 Feb, 2010 09:24 AM

I saw that there was a thread about this previously, but I am pretty sure there is a bug in v1.03 with injector.mapSingleton( foo )
In previous releases I was able to map a singleton without issue, but now I am getting the missing rule error.

in the Context startup method I have this:


TestModel is this:

public class TestModel extends Actor
    * @constructor
    public function TestModel()


Trying to use it like this:

public class ApplicationMediator extends Mediator
    [Inject] public var model:TestModel;

    override public function onRegister():void

Throws an error every time.

  1. 1 Posted by kristoferjoseph on 07 Feb, 2010 09:29 AM

    kristoferjoseph's Avatar

    I figured it out.
    It was an order of operation issue.
    It seems you need to map the singleton before your mediator mappings.
    Otherwise there is a race condition where the mediator is created before the model is instantiated.
    The error message is just misleading.

  2. Support Staff 2 Posted by Till Schneidere... on 07 Feb, 2010 11:57 AM

    Till Schneidereit's Avatar

    I guess you're probably mediating the contextView in addition to other
    views, right? If so, that's what is causing what you're seeing:
    The MediatorMap has a special case for handling the contextView
    which causes the mediator for that to be created immediately during
    the call to MediatorMap#mapView.
    In that case, the injector tries to inject into the contextView's
    mediator and fails if you're only creating the injection rules

  3. 3 Posted by kristoferjoseph on 07 Feb, 2010 11:22 PM

    kristoferjoseph's Avatar

    Exactly. I must have missed the update that added the mapping of


  4. Till Schneidereit closed this discussion on 08 Feb, 2010 03:56 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac