User Tools

Site Tools


lazy_binding_with_guice

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

lazy_binding_with_guice [2017/07/14 06:38] (current)
mihael created
Line 1: Line 1:
 +====== Lazy Binding with Guice ======
 +Everything in Guice is bound immediately. You cannot specify something like //lazy binding//. But what you can do is not binding to the desired object itself but to the provider of the object:
  
 +<sxh>
 +@Inject
 +private Provider<​Client>​ clientProvider;​
 +</​sxh>​
 +
 +By this way you can choose when to retrieve the desired object when need at not at object instantiation.
 +
 +{{tag>​devel java guice}}
lazy_binding_with_guice.txt ยท Last modified: 2017/07/14 06:38 by mihael