开发者

Guice: How to dynamically update definitions in a module w/out losing preexisting singletons

开发者 https://www.devze.com 2023-02-19 07:32 出处:网络
I would like to (re)create another Injector using the definitions already a part of another Inj开发者_如何学Pythonector with the following:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消