(no commit message)
[utils] / wicket / joe / src / main / java / org / wamblee / wicket / inject / ComponentInstantiationInjector.java
index d361ebc3c7e864771ce4e584a3cb7334cde66542..a4a0dcf96b4bbbac73a01581ffe8192bf78e3e08 100644 (file)
@@ -17,14 +17,30 @@ package org.wamblee.wicket.inject;
 
 import org.apache.wicket.Component;
 import org.apache.wicket.application.IComponentInstantiationListener;
-import org.wamblee.inject.InjectorFactoryBuilder;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.wamblee.inject.InjectorBuilder;
 import org.wamblee.inject.SimpleInjector;
 
 /**
+ * <p>
  * Component instantiation listener that injects references into a component 
  * using the injector mini-framework. Together with an implementation of the 
- * mini-framework, Contexts and Depenency Injection support can be provided. 
+ * mini-framework, Contexts and Dependency Injection support can be provided or
+ * for standard Java EE injection into components. Or, other injection 
+ * frameworks can be used.
+ * </p>
  * 
+ * <p>
+ * To use this injector override {@link WebApplication#init()} and add the 
+ * listener: 
+ * </p>
+ * <pre>
+ *    &#064;Override
+ *    protected void init() {
+ *       super.init();
+ *       addComponentInstantiationListener(new ComponentInstantiationInjector());
+ *    }
+ * </pre>
  * 
  * @author Erik Brakkee
  */
@@ -37,12 +53,13 @@ public class ComponentInstantiationInjector implements
      * Constructs the component instantiation listener. 
      */
     public ComponentInstantiationInjector() { 
-        injector = new SimpleInjector(InjectorFactoryBuilder.getInjectorFactory());
+        injector = new SimpleInjector(InjectorBuilder.getInjectorFactory());
     }
     
     @Override
     public void onInstantiation(Component aComponent) {
         injector.inject(aComponent);
+        aComponent.add(new InjectionBehavior());
     }
 
 }