Author: gpetracek
Date: Mon Apr 21 15:15:23 2014
New Revision: 1588896

URL: http://svn.apache.org/r1588896
Log:
DELTASPIKE-156 thx to Karl Kildén

Modified:
    deltaspike/site/trunk/content/container-control.mdtext

Modified: deltaspike/site/trunk/content/container-control.mdtext
URL: 
http://svn.apache.org/viewvc/deltaspike/site/trunk/content/container-control.mdtext?rev=1588896&r1=1588895&r2=1588896&view=diff
==============================================================================
--- deltaspike/site/trunk/content/container-control.mdtext (original)
+++ deltaspike/site/trunk/content/container-control.mdtext Mon Apr 21 15:15:23 
2014
@@ -28,8 +28,25 @@ There are basically two parts:
   - The **ContextControl** interface allows to control the life-cycle of the 
built-in contexts of the CDI container.
 
 ## CdiContainer
+You can use the CdiContainerLoader as a simple factory to gain access to the 
underlying CdiContainer implementation. This is of little interest for Java EE 
applications since the CDI Container 
+already gets properly booted and shut down by the Servlet container 
integration.
+    
 
-See the Java SE part [above](#start-a-cdi-container-using-java-se).
+    :::java
+    // this will give you a CdiContainer for Weld or OWB, depending on the jar 
you added
+    CdiContainer cdiContainer = CdiContainerLoader.getCdiContainer();
+
+    // now we gonna boot the CDI container. This will trigger the classpath 
scan, etc
+       cdiContainer.boot();
+
+    // and finally we like to start all built-in contexts
+    cdiContainer.getContextControl().startContexts();
+
+    // now we can use CDI in our SE application.
+    // And there is not a single line of OWB or Weld specific code in your 
project!
+
+    // finally we gonna stop the container
+    cdiContainer.shutdown();
 
 ## ContextControl usage
 


Reply via email to