need to know about mapsingletonOf

itsmylifesoham's Avatar

itsmylifesoham

13 Feb, 2012 06:49 AM via web

hi,

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 2 Posted by Till Schneidereit 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. 3 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.