Robotlegs: Warning: Injector already has a rule for type

Posted by MikeW on Stack Overflow See other posts from Stack Overflow or by MikeW
Published on 2012-10-06T12:30:34Z Indexed on 2012/10/07 15:37 UTC
Read the original article Hit count: 181

Filed under:
|

I have a bunch of warning messages like this appear when using Robotlegs/Signals. Everytime this command class executes, which is every 2-3 seconds ..this message displays below

If you have overwritten this mapping intentionally you can use "injector.unmap()" prior to your replacement mapping in order to avoid seeing this message. Warning: Injector already has a rule for type "mx.messaging.messages::IMessage", named "".

The command functions fine otherwise but I think I'm doing something wrong anyhow.

    public class MessageReceivedCommand extends SignalCommand
    {

        [Inject]
        public var message:IMessage;

            ...etc.. do something with message..
    }

the application context doesnt map IMessage to this command, as I only see an option to mapSignalClass , besides the payload is received fine.

Wonder if anyone knows how I might either fix or suppress this message. I've tried calling this as the warning suggests

injector.unmap(IMessage, "")

but I receive an error - no mapping found for ::IMessage named "".

Thanks

Edit: A bit more info about the error

Here is the signal that I dispatch to the command

public class GameMessageSignal extends Signal
{   
    public function GameMessageSignal()
    {
        super(IMessage);
    }
}

which is dispatched from a IPushDataService class

    gameMessage.dispatch(message.message);

and the implementation is wired up in the app context via

injector.mapClass(IPushDataService, PushDataService);

along with the signal

signalCommandMap.mapSignalClass(GameMessageSignal, MessageReceivedCommand);

Edit #2: Probably good to point out also I inject an instance of GameMessageSignal into IPushDataService

public class PushDataService extends BaseDataService implements IPushDataService
{
   [Inject]
   public var gameMessage:GameMessageSignal;

   //then

   private function processMessage(message:MessageEvent):void
   {
          gameMessage.dispatch(message.message);
   }
}

Edit:3

The mappings i set up in the SignalContext:

injector.mapSingleton(IPushDataService);

injector.mapClass(IPushDataService, PushDataService);

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about robotlegs