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 Version 8.0 or Version 8.5
Important: These samples were tested with WebSphere Application Server
Version 8.0 and Version 8.5.
Samples download
To use the samples, download
Contexts and Dependency Injection sample files from a product download
site. Complete the following steps:
- 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.
- From the displayed dialog, specify the target directory to which
to save the compressed file and click OK.
- 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.