Author: limpbizkit
Date: Mon Mar  2 21:04:42 2009
New Revision: 891

Added:
    wiki/InstanceBindings.wiki

Log:
Created wiki page through web user interface.

Added: wiki/InstanceBindings.wiki
==============================================================================
--- (empty file)
+++ wiki/InstanceBindings.wiki  Mon Mar  2 21:04:42 2009
@@ -0,0 +1,11 @@
+=Instance Bindings=
+You can bind a type to a specific instance of that type. This is usually  
only useful only for objects that don't have dependencies of their own,  
such as value objects:
+{{{
+    bind(String.class)
+        .annotatedWith(Names.named("JDBC URL"))
+        .toInstance("jdbc:mysql://localhost/pizza");
+    bind(Integer.class)
+        .annotatedWith(Names.named("login timeout seconds"))
+        .toInstance(10);
+}}}
+Avoid using `.toInstance` with objects that are complicated to create,  
since it can slow down application startup. You can use an `...@provides`  
method instead.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to