Hi, I am overriding a service using the following pattern:

 

public static void bind(ServiceBinder binder) {

      binder.bind(Session.class, TrackedSession.class).withId(

                  "TrackedSession");

}

 

public static void contributeServiceOverride(

            MappedConfiguration<Class, Object> configuration,

            @Local Session session) {

      configuration.add(Session.class, session);

}

 

This is working fine as far as injecting the Session into other
services, and the base service is injected into TrackedSession
correctly. 

 

However, in a unit test if I call registry.getService(Session.class) it
complains that there are two instances of Session available.

 

Does it make sense that registry.getService() behaves differently than
@Inject? Or perhaps there's a better way to construct my test that does
use @Inject.

 

It's not a big deal because I can call up the service by the alias. We
are using 5.1.0.1 btw.

 

Thanks!

Alfie.

Reply via email to