Created
January 10, 2018 16:38
-
-
Save bbaugher/55bd51a68be71973169fc6467c024cc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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