Are there any viable alternatives to the GOF Singleton Pattern?

后端 未结 16 1472
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 16:58

Let\'s face it. The Singleton Pattern is highly controversial topic with hordes programmers on both sides of the fence. There are those who feel like the Singleto

16条回答
  •  情深已故
    2020-11-29 17:41

    Spring or any other IoC-Container does a reasonably good job in that. Since the classes are created and managed outside the app itself, the container can make simple classes singletons and inject them where needed.

提交回复
热议问题