Difference between singleton and eagersingleton for Gin or Guice?

I was wondering what distinguishes singleton and eagersingleton from Gin or Guice?

+7
source share
1 answer

From Guice Wiki

The expected singlets show initialization problems earlier and ensure that end users get a consistent, fast experience. Lazy singleletons speed up the development cycle in edit mode. Use the Stage enumeration to specify which strategy should be used.

  • Eager: "create an instance of this class when starting the module"
  • Lazy: "instantiate this class when it first requested dependency injection"
+7
source

All Articles