Sounds like this depends on exactly what behavior you want.

You can overwrite bindings in a module with an Override's module. See:
http://stackoverflow.com/questions/483087/overriding-binding-in-guice

You could use a PrivateModules to divide your object graph to control which
chunks get which logger. See:
http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/PrivateModule.html

You could use an OptionalBinder setting the default to your standard
logger.
http://google.github.io/guice/api-docs/latest/javadoc/com/google/inject/multibindings/OptionalBinder.html

Of course, I might completely miss your question.



On Thu Jan 22 2015 at 3:55:21 PM Kevin Burton <[email protected]> wrote:

> Is there a good pattern to *replace* dependencies with new bindings?
>
> During our init, I have the need to replace a standard output logger, with
> a log4j logger...
>
> It only needs to happen once.
>
> I was thinking of having some sort of ReplaceableProvider that has a set()
> method and uses an AtomicReference...
>
> --
> You received this message because you are subscribed to the Google Groups
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-guice/c8bdabad-9e5a-44f4-a0e4-a7ca3f65a9e8%40googlegroups.com
> <https://groups.google.com/d/msgid/google-guice/c8bdabad-9e5a-44f4-a0e4-a7ca3f65a9e8%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-guice/CAHNex9-R7kL74OYEMRSX-GKhCR0B1M3vDSwJU5VSp9zZWx9w%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to