Guice: How to dynamically update definitions in a module w/out losing preexisting singletons
I would like to (re)create another Injector using the definitions already a part of another Inj开发者_如何学Pythonector with the following:
- add, remove, replace existing definitions
- singletons belonging to existing definitions in the "source" injector are carried over to the "new" injector.
The Guice SPI may help, albeit even partially. Guice 3.0 allows you to query the Injector
for the current bindings.
The injector maintains immutable state for each binding so your success with this may or may not be the best.
精彩评论