Guice Singleton scope provider example

Guice Singleton scope provider example

In previous Guice tutorial you saw how to use it. In this tutorial I will show you how Singleton scope works in Google Guice framework with simple example:

  • HelloGuiceServiceProvider.java which implements Provider interface:

  • HelloGuiceModule.java is module class where binding of String.class has been done with its provider class in Singleton scope:

  • ProviderConcreteMainClass.java is main class to test Singleton scope:

  • Output:

2015-04-19_2348

  • For more information please visit Google Guice official documentation here

download  Download project:  GoogleGuiceProvider

Leave a Reply

Your email address will not be published. Required fields are marked *