I think you are vastly overestimating the amount of times Guice will create
a proxy object. Guice will continue working fine (without proxying) if
a) there is no circular dependency at all,
b) dependencies are injected using Provider<X> instead of X
c) the the circular dependency is only within setters methods (not
d) if the circular dependency exists in the setter method of the first
constructed object (even if it's in the constructor of the second one).
Of those cases, the only one that could stand to be improved is d). The
improvement would make it so that the proxies aren't constructed even if the
reverse situation is true (constructor in first object, setter in second).
But, given that there's other perfectly viable ways to fix it -- such as
injecting Provider<X> instead of X -- I'm not as down on the proxies as you.
If you absolutely want to forbid Guice from creating a proxy, because it's
ruining your logic, then use disableCircularProxies and tell Guice to
generate an exception whenever it was going to create a proxy. Then look
through the code and re-arrange it (either removing the circular
dependencies, using Provider, etc..) so that Guice will not create a proxy.
2010/7/28 Endre Stølsvik <stols...@gmail.com>