I annotate those service interfaces to have a kind of documentation pay off.


2013/10/19 Thiago H. de Paula Figueiredo <[email protected]>

> Unless I'm mistaken (I cannot test this now,) if you have ServiceA extends
> ServiceB and ServiceImpl implements ServiceA, if you do a
> binder.bind(ServiceA.class, ServiceImpl.class) and @Inject ServiceA
> serviceA and @Inject ServiceB serviceB, it will work (serviceA ==
> serviceB). Have you tested this? If not, please do.
>
> Anyway, this is for sure: you can declare any service with any scope
> (singleton or perthread) with both binder.bind() and builder methods. To
> declare a perthread service with binder.bind(), just call
> binder.bind(...).scope(ScopeConstants.PERTHREAD).
>
>
> On Sat, Oct 19, 2013 at 6:02 AM, Martin Kersten <
> [email protected]
> > wrote:
>
> > Hi there,
> >
> >    I just wonder how I can simply define a service applying to multiple
> > Service interfaces at the same time.
> >
> > I know there was this auto discovery feature of the IOC.
> >
> > Lets say we have this hierachy: SerivceImpl -> ServiceA -> ServiceB
> >
> > I want ServiceImpl to be registered for ServiceA and ServiceB.
> >
> > and that registry.getService(ServiceA) == registry.getService(ServiceB).
> >
> > Is there any way (beside registering a builder instead)? The service
> would
> > be
> > PerThread so I can do this with a builder but I would love to have
> > something
> > different.
> >
> >
> >
> > Cheers,
> >
> > Martin (Kersten),
> > Germany
> >
>
>
>
> --
> Thiago
>

Reply via email to