Hi,
I've found a problem with @PreDestroy methods being invoked more than once. It
happens when providers return the same object. With linked bindinds Interface
-> Class, Guice will create an internal jit ConstructorBinding for Class so
Injector.getAllBindings() will return two providers that return the same object.
It should be solvable by gathering all objects in an IdentityHashSet and then
destroy them.
Here's a failing test case, http://pastie.org/2176603
The last test shows that when binding a Provider, it will get its
@PostConstruct called since Guice injects into it, but it will not get its
@PreDestroy called. Maybe this is intentional. The same things goes for objects
that get passed to injectMembers(), used with a MembersInjector() and
Binder.requestInjection() i guess.
Original issue reported on code.google.com by totobobi...@gmail.com on 7 Jul 2011 at 8:52
Original issue reported on code.google.com by
totobobi...@gmail.com
on 7 Jul 2011 at 8:52