how to create an object from a different scope

自作多情 提交于 2019-12-10 20:27:37

问题


I have an object in Guice with scope singleton. In method f() I want to create a new object but let Guice do the injection. I think it is not a good practice to pass the injector around.
So how can I get a new "Guicy" instance of object?


回答1:


As suggested above, probably provider is the way to do it. it is also mentioned in this question.



来源:https://stackoverflow.com/questions/9819794/how-to-create-an-object-from-a-different-scope

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!