The CDI sample contains a server definition which includes the CDI and JSP features. It also contains a very simple CDI application, cdiApp.war, which contains a single JSP, sample.jsp. This JSP looks up a request-scoped bean that is also injected with another request-scoped bean. The JSP prints a message indicate whether or not the beans were correctly injected by the container.
This sample can be installed onto runtime versions 8.5.5.0 and later.
To run the cdiApp application:
java -jar cdiSample.jar
bin
directory in the Liberty profile installation:
server run cdiSample
CWWKZ0001I: Application cdiApp started in XX.XX seconds.
Congratulations! You successfully used CDI to inject a bean at the request scope!
The cdiApp.war
file contains the source and binaries for the application, and can be
used to import it to Eclipse.
For further information and resources for developers using IBM WebSphere Application Server, please visit wasdev.net.