Explicit service injection by service interface

View: New views
1 Messages — Rating Filter:   Alert me  

Explicit service injection by service interface

by Raffael Herzog-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Sometimes there's no way but to explicitly inject services, mostly when
there are two implementations of the same service interface. If the service
should be injected into the constructor, having to do this has a major
drawback: You'll have to inject *everything* explicitly, not just the
amiguous service.

Extending BuilderFactory a little bit could solve that problem: If we'd add
something like

  <service-iface>my.pkg.MySerivceIface</service-iface>

in addition to

  <service>my.module.MyService</service>

it would be possible to explicitly specify the ambiguous service explicitlyx
while still having HiveMind resolve the other ones.

Cheers,
   Raffi

--
The difference between theory and practice is that in theory, there is
no difference, but in practice, there is.

herzog@... · Jabber: herzog@...
PGP Key 0x5FFDB5DB5D1FF5F4 · http://keyserver.pgp.com
LightInTheBox - Buy quality products at wholesale price