Search in sources :

Example 6 with AbstractBinder

use of org.glassfish.hk2.utilities.binding.AbstractBinder in project jersey by jersey.

the class InjectionManagerTest method testServiceLocatorParent.

@Test
public void testServiceLocatorParent() {
    AbstractBinder binder = new AbstractBinder() {

        @Override
        protected void configure() {
            bindAsContract(EnglishGreeting.class);
        }
    };
    ServiceLocator parentLocator = ServiceLocatorUtilities.bind(binder);
    InjectionManager injectionManager = new HK2InjectionManager();
    injectionManager.initialize(parentLocator);
    assertNotNull(injectionManager.getInstance(EnglishGreeting.class));
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) AbstractBinder(org.glassfish.hk2.utilities.binding.AbstractBinder) InjectionManager(org.glassfish.jersey.internal.inject.InjectionManager) Test(org.junit.Test)

Aggregations

AbstractBinder (org.glassfish.hk2.utilities.binding.AbstractBinder)5 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)3 Test (org.junit.Test)3 DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)2 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)2 ServiceLocatorFactory (org.glassfish.hk2.api.ServiceLocatorFactory)2 InjectionManager (org.glassfish.jersey.internal.inject.InjectionManager)2 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 ClassAnalyzer (org.glassfish.hk2.api.ClassAnalyzer)1 AbstractBinder (org.glassfish.jersey.internal.inject.AbstractBinder)1 Binder (org.glassfish.jersey.internal.inject.Binder)1 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)1 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 Ignore (org.junit.Ignore)1