Custom Guice Scope, or a better approach?

后端 未结 4 1485
迷失自我
迷失自我 2020-12-13 14:55

Here\'s my problem:

It\'s first important to know that I\'m writing a simulation. This is a standalone application, and is single-threaded. I have essentially two

4条回答
  •  难免孤独
    2020-12-13 15:45

    May I ask why do you need to have singletons ?

    I would not recommend to create custom scope. The best and easiest way to mix scopes is to inject providers instead of objects. With the providers you can control the scope of your object from you business code logic.

    See this Guice documentation for details.

提交回复
热议问题