Chapter 2. Setting Up Your Project

Add dependencies for the Data Grid Spring Boot Starter to your project.

2.1. Enforcing Data Grid Versions

This starter uses a high-level API to ensure compatibility between major versions of Data Grid. However you can enforce a specific version of Data Grid with the infinispan-bom module.

Add infinispan-bom to your pom.xml file before the starter dependencies, as follows:

<dependencyManagement>
    <dependencies>
       <dependency>
           <groupId>org.infinispan</groupId>
           <artifactId>infinispan-bom</artifactId>
           <version>${version.infinispan}</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-parent</artifactId>
           <version>${version.spring.boot}</version>
           <type>pom</type>
           <scope>import</scope>
       </dependency>
       <dependency>
           <groupId>org.infinispan</groupId>
           <artifactId>infinispan-spring-boot-starter</artifactId>
           <version>2.3.6.Final-redhat-00001</version>
       </dependency>
    </dependencies>
 </dependencyManagement>
Important

The Data Grid Spring Boot starter uses different Spring Boot versions to other projects such as Red Hat OpenShift Application Runtimes. If you want to use a specific Spring Boot version for compatibility with other projects, you must add the correct dependency to your project.

2.2. Adding Dependencies for Usage Modes

Data Grid provides different dependencies for each usage mode. Add one of the following to your pom.xml file:

Embedded Mode

<dependency>
  <groupId>org.infinispan</groupId>
  <artifactId>infinispan-spring-boot-starter-embedded</artifactId>
  <version>2.3.6.Final-redhat-00001</version>
</dependency>

Remote Client/Server Mode

<dependency>
  <groupId>org.infinispan</groupId>
  <artifactId>infinispan-spring-boot-starter-remote</artifactId>
  <version>2.3.6.Final-redhat-00001</version>
</dependency>