Author: Kevin Pollet, Sebastian Laskawiec
Level: Beginner
Technologies: Infinispan, CDI, JCache
Summary: The cdi-jdg
quickstart demonstrates how to inject Infinispan caches into application and how to use JCache annotations such as @CacheResult.
Target Product: JDG
Product Versions: JDG 7.x, EAP 7.x
Source: https://github.com/infinispan/jdg-quickstart
The cdi-jdg
quickstart demonstrates injection of Infinispan caches into a web application using CDI. It it worth to mention
that dependencies used in this quickstart needs to be present in EAP instance. In other words, one needs to install JDG
EAP modules. If one wishes to run this quickstart without EAP modules, the scope of JDG dependencies must be changed
from provided
into compile
. A manifest entry with dependencies also needs to be removed.
Additionally, this quickstart uses JCache integration which makes accessing Cache much easier.
All you need to build this project is Java 8.0 (Java SDK 1.8) or better, Maven 3.0 or better.
The application this project produces is designed to be run on Red Hat JBoss Enterprise Application Platform 7.0 or later.
If you have not yet done so, you must Configure Maven before testing the quickstarts.
Download JDG EAP modules and copy them to %JBOSS_HOME%/modules
directory.
-
Open a command line and navigate to the root of the EAP server directory.
-
Download the Library Module for JBoss EAP
-
Apply the modules to your EAP installation as described within the downloaded modules
-
The following shows the command line to start the server with the web profile:
For Linux: $JBOSS_HOME/bin/standalone.sh For Windows: %JBOSS_HOME%\bin\standalone.bat
-
Make sure you have started EAP as described above.
-
Open a command line and navigate to the root directory of this quickstart.
-
Type this command to build and deploy the archive:
mvn clean package wildfly:deploy
-
This will deploy
target/infinispan-cdi.war
to the running instance of the server.
The application will be running at the following URL: http://localhost:8080/infinispan-cdi/
-
Make sure you have started EAP as described above.
-
Open a command line and navigate to the root directory of this quickstart.
-
When you are finished testing, type this command to undeploy the archive:
mvn wildfly:undeploy
If you would like to test the application, there are a couple of unit tests designed to run on a remote EAP/Wildfly instance.
In order to run those test, please do the following steps:
-
Start EAP/Wildfly
-
Build the quickstart using:
mvn clean test -Peap-remote