Skip to content

Instantly share code, notes, and snippets.

@bbaugher
Created January 10, 2018 16:38
Show Gist options
  • Save bbaugher/55bd51a68be71973169fc6467c024cc8 to your computer and use it in GitHub Desktop.
Save bbaugher/55bd51a68be71973169fc6467c024cc8 to your computer and use it in GitHub Desktop.
import com.cerner.beadledom.client.BeadledomClientModule;
import com.google.inject.AbstractModule;
import com.google.inject.BindingAnnotation;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.google.inject.PrivateModule;
import org.junit.Test;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
public class ConflictExample {
@Test
public void conflict() {
Injector injector = Guice.createInjector(new MyPublicModule(), new MyPrivateModule());
}
@BindingAnnotation
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PrivateFeature {
}
private class MyPrivateModule extends PrivateModule {
@Override
protected void configure() {
install(BeadledomClientModule.with(PrivateFeature.class));
}
}
@BindingAnnotation
@Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface PublicFeature {
}
private class MyPublicModule extends AbstractModule {
@Override
protected void configure() {
install(BeadledomClientModule.with(PublicFeature.class));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment