@Test public void jersey_binds_work() { final Object jerseyComponent = new Object(); final Class<TestResource> jerseyComponentClass = TestResource.class; Injector injector = Guice.createInjector(new AbstractPlugin() { @Override protected void configure() { bindJerseyComponent(jerseyComponent); bindJerseyComponent(jerseyComponentClass); } }); Set<Object> jerseySet = injector.getInstance(Keys.JerseyComponents); assertThat(jerseySet, hasSize(2)); assertThat(jerseySet, hasItem(jerseyComponent)); assertThat(jerseySet, hasItem(TestResource.class)); }
protected void bindJerseyComponent(Object resource) { Preconditions.checkNotNull(resource, "Resource cannot be null."); buildBinders(); jerseyBinder.addBinding().toInstance(resource); }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindJerseyComponent(Object resource) { Preconditions.checkNotNull(resource, "Resource cannot be null."); buildBinders(); jerseyBinder.addBinding().toInstance(resource); } }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindJerseyComponent(Object resource) { Preconditions.checkNotNull(resource, "Resource cannot be null."); buildBinders(); jerseyBinder.addBinding().toInstance(resource); }  }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindJerseyComponent(Object resource) { Preconditions.checkNotNull(resource, "Resource cannot be null."); buildBinders(); jerseyBinder.addBinding().toInstance(resource); }   }
AbstractPlugin extends AbstractModule implements Plugin { protected void bindJerseyComponent(Object resource) { Preconditions.checkNotNull(resource, "Resource cannot be null."); buildBinders(); jerseyBinder.addBinding().toInstance(resource); }    }