I'm finding some behavior that is a little unintuitive. 

My guice modules are broken up into small composable chunks. I have a 
private module which is used twice (two different instances of an api 
framework -- once for external consumption and once for internal 
consumption). One of my non-private modules contains a monitoring framework.

The monitoring framework works by calling registerInstance(instance: 
Object, context: String). So I've created a TypeListener inside of this 
non-private module that registers every instance (using Matchers.any).

Here's the issue. Every instance created inside of the private module also 
gets passed to this bound type listener. What I really want to be able to 
do is bind a different type listener inside of the private module that sets 
the context (i.e. internal api vs external api) for that instance. But now 
every private instance gets registered twice, once without a context and 
once with one.

What is the recommended practice in a situation like this?

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/GDvpm7IKGHQJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to