need to know about mapsingletonOf

itsmylifesoham's Avatar


13 Feb, 2012 06:49 AM


i have some basic doubt. lets say i have mapped a service as injector.mapSingletonOf( IMyservice, MyService);

when exactly does the singleton object of Myservice come into being?

For instance in one of my commands i have injected the IMyservice(its the first injection of IMyservice anywhere in the project), and i am calling a method on the injected object. Now i need to know, if the Myservice singleton instance got created when it was injected the first time, or was it created even before it was injected anywhere. i know that second time it would be injected anywhere else the same singleton instance will be delivered.

  1. Support Staff 1 Posted by Till Schneidere... on 13 Feb, 2012 01:27 PM

    Till Schneidereit's Avatar

    A singleton gets created lazily, i.e. it is created the first time it
    is injected.

  2. 2 Posted by itsmylifesoham on 13 Feb, 2012 02:10 PM

    itsmylifesoham's Avatar

    yea, had thought the same. thanks :)

  3. Ondina D.F. closed this discussion on 13 Feb, 2012 06:16 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