Skip to content

Instantly share code, notes, and snippets.

@dgageot
Created May 2, 2014 10:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgageot/7cc0d1506f5a663918d7 to your computer and use it in GitHub Desktop.
Save dgageot/7cc0d1506f5a663918d7 to your computer and use it in GitHub Desktop.
Guice cycle proxies
@Override
protected void configure() {
// ... insert the bindings here
binder().disableCircularProxies();
}
@Override
protected void configure() {
// ... insert the bindings here
bindListener(Matchers.any(), new TypeListener() {
@Override
public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) {
typeEncounter.register((InjectionListener<I>) bean -> {
if (Scopes.isCircularProxy(bean)) {
System.out.println(typeLiteral.getRawType().getName());
}
});
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment