Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not bind component already binded by the parent

  • Loading branch information...
commit 33a0f5ab3a304fdf1dcbc698aa4dffb580f6d36d 1 parent c59d49c
@jfarcand jfarcand authored
View
10 restsimple-jaxrs/src/main/java/org/sonatype/restsimple/jaxrs/guice/RestSimpleJaxrsModule.java
@@ -99,10 +99,14 @@ protected final void configureServlets() {
}
NegotiationTokenGenerator token = injector.getInstance( NegotiationTokenGenerator.class );
- bind(NegotiationTokenGenerator.class).toInstance( token );
+ if (parent == null || parent.getBinding(NegotiationTokenGenerator.class ) == null) {
+ bind(NegotiationTokenGenerator.class).toInstance( token );
+ }
- ServiceHandlerMapper mapper = injector.getInstance( ServiceHandlerMapper.class );
- bind( ServiceHandlerMapper.class ).toInstance( mapper );
+ ServiceHandlerMapper mapper = injector().getInstance( ServiceHandlerMapper.class );
+ if (parent == null || parent.getBinding(ServiceHandlerMapper.class ) == null) {
+ bind( ServiceHandlerMapper.class ).toInstance( mapper );
+ }
sdSet.addAll( defineServices( injector ) );
ServiceDefinitionGenerator generator = new JAXRSServiceDefinitionGenerator( new ResourceModuleConfig<Module>() {
View
8 ...simple-sitebricks/src/main/java/org/sonatype/restsimple/sitebricks/guice/RestSimpleSitebricksModule.java
@@ -111,10 +111,14 @@ public void install(Module module) {
});
NegotiationTokenGenerator token = injector.getInstance( NegotiationTokenGenerator.class );
- bind(NegotiationTokenGenerator.class).toInstance( token );
+ if (parent == null || parent.getBinding(NegotiationTokenGenerator.class ) == null) {
+ bind(NegotiationTokenGenerator.class).toInstance( token );
+ }
ServiceHandlerMapper mapper = injector().getInstance( ServiceHandlerMapper.class );
- bind( ServiceHandlerMapper.class ).toInstance( mapper );
+ if (parent == null || parent.getBinding(ServiceHandlerMapper.class ) == null) {
+ bind( ServiceHandlerMapper.class ).toInstance( mapper );
+ }
if (sdSet != null && sdSet.size() > 0) {
for (ServiceDefinition sd : sdSet) {
Please sign in to comment.
Something went wrong with that request. Please try again.