Contexts and Dependency Injection samples

The Contexts and Dependency Injection (CDI) samples provide an easy way for customers to get started with CDI, by modifying the sample code. The samples demonstrate key CDI concepts, including CDI Managed Beans, EJB and backend integration, bean types, qualifiers, scopes and contexts, decorators and interceptors, producers and disposers, and alternatives.

Time required to set up and configure these samples

5 minutes

Prerequisites for use

  • WebSphere® Application Server V8.0
Important: These samples were tested with WebSphere Application Server Version 8.0.

Samples download

To use the samples, download Contexts and Dependency Injection sample files from a product download site. Complete the following steps:

  1. Choose one of the following methods to download the JCDISamples.zip file to a directory on your workstation: FTP or HTTP. You might create the /samples/JCDISamples directory path on your workstation and download Contexts and Dependency Injection sample files to that directory path.
  2. From the displayed dialog, specify the target directory to which to save the compressed file and click OK.
  3. The JCDISamples.zip file contains sample files in the following directory structure:
    /images
    /installableApps
    /META_INF
    /scripts
    /src
    /style
    build.xml
    readme.html
    Attention: The readme.html file contains information for installing and running the sample.

Samples description

basicSample.war

This sample illustrates the use of Scopes and Contexts, including normal and pseudo scopes, producers, and disposers.

ejbsamples.war

This sample illustrates the use of JSF integration with CDI, qualifiers, decorators, dependent beans.

xmlsamples.war

This sample includes advanced usage scenarios of alternatives, decorators, and interceptors for managed beans.




Related tasks
WebSphere Application Server Version 8.0 samples
Concept topic Concept topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 20, 2011 1:12:33 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-mp&topic=sample_cdi
File name: sample_cdi.html