use of org.glassfish.jersey.internal.inject.AbstractBinder in project jersey by jersey.
the class ServiceFinderBinderTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
AbstractBinder binder = new AbstractBinder() {
@Override
protected void configure() {
bind(TestServiceB.class).to(TestContract.class);
bind(TestServiceD.class).to(TestContract.class);
install(new ServiceFinderBinder<>(TestContract.class, null, RuntimeType.SERVER));
}
};
injectionManager = Injections.createInjectionManager(binder);
}
use of org.glassfish.jersey.internal.inject.AbstractBinder in project jersey by jersey.
the class BindingTestHelper method bind.
/**
* Accepts the provided consumer to created and register the binder.
*
* @param injectionManager injection manager which accepts the consumer.
* @param bindConsumer consumer to populate a binder.
*/
static void bind(InjectionManager injectionManager, Consumer<AbstractBinder> bindConsumer) {
AbstractBinder binder = new AbstractBinder() {
@Override
protected void configure() {
bindConsumer.accept(this);
}
};
injectionManager.register(binder);
}
use of org.glassfish.jersey.internal.inject.AbstractBinder in project jersey by jersey.
the class WadlFeature method configure.
@Override
public boolean configure(FeatureContext context) {
final boolean disabled = PropertiesHelper.isProperty(context.getConfiguration().getProperty(ServerProperties.WADL_FEATURE_DISABLE));
if (disabled) {
return false;
}
context.register(WadlModelProcessor.class);
context.register(new AbstractBinder() {
@Override
protected void configure() {
bind(WadlApplicationContextImpl.class).to(WadlApplicationContext.class).in(Singleton.class);
}
});
return true;
}
use of org.glassfish.jersey.internal.inject.AbstractBinder in project jersey by jersey.
the class InjectionManagerProviderTest method testFeatureInstance.
@Test
public void testFeatureInstance() {
final Response response = target().path("resource").register(new AbstractBinder() {
@Override
protected void configure() {
bind(new MyInjectedService("feature")).to(MyInjectedService.class);
}
}).register(new MyFeature()).request().post(Entity.entity("will-be-extended-by", MediaType.TEXT_PLAIN_TYPE));
assertEquals(200, response.getStatus());
assertEquals("will-be-extended-by-interceptor-feature", response.readEntity(String.class));
}
Aggregations