Error: Injector mapping override for type

ndangduy's Avatar

ndangduy

29 Aug, 2013 08:49 PM

I have a ReportView mapped as singleton in AppConfig.

Then in MainView,
[Inject]
public var injector:IInjector;
[Inject]
public var pageReport:ReportView;

injector.unmap( ReportView );
pageReport = injector.getOrCreateNewInstance(ReportView);
oNewContent.addElement(pageReport);

How come i always get error when i minimize the window:
Warning: Injector already has a mapping for com.nielsen.catcast.report.view::ReportView|.
 If you have overridden this mapping intentionally you can use "injector.unmap()" prior to your replacement mapping in order to avoid seeing this message.
Error: Injector mapping override for type

  1. Support Staff 1 Posted by Ondina D.F. on 30 Aug, 2013 07:42 AM

    Ondina D.F.'s Avatar

    Hello,

    It looks like you have more than one mapping for your ReportView.
    I suppose that you are mapping the view to a mediator as well. Maybe you have 2 mappings for your ReportView, like these:

    injector.map(ReportView).asSingleton();

    and

    mediatorMap.map(ReportView).toMediator(ReportMediator);

    So, one mapping overrides the other, and that's why you're getting the error.
    To avoid this, you could use the ViewProcessorMapExtension instead of the mediatorMap:

    viewProcessorMap.map(ReportView).toProcess( new MediatorCreator(ReportMediator));

    Let me know if that solves your problem.

    If that's not your use case, then you should provide more info. Show us your code where you perform the mappings. Or, you can attach your project or a simple example reproducing the issue as a zip file, and I'll take a look at it.

    Ondina

  2. Ondina D.F. closed this discussion on 23 Sep, 2013 02:36 PM.

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

Keyboard shortcuts

Generic

? 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