Chapter 1. Setting up the Spring Boot Starter


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

Important

Data Grid supports Spring Boot version 2.x and version 3. Be aware that Spring Boot version 3 requires Java 17.

The examples in this document include artifacts for the latest version of Spring Boot. If you want to use Spring Boot 2.x use:

  • infinispan-spring-boot-starter-embedded
  • infinispan-spring-boot-starter-remote

1.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.

Procedure

  • Add infinispan-bom to your pom.xml file before the starter dependencies.

    <properties>
      <version.infinispan>14.0.21.Final-redhat-00001</version.infinispan>
    </properties>
    
    <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-boot3-starter</artifactId>
           </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.

1.2. Adding Dependencies for Usage Modes

Data Grid provides different dependencies for embedded caches and remote caches.

Procedure

  • Add one of the following to your pom.xml file:

Embedded caches

<dependency>
  <groupId>org.infinispan</groupId>
  <artifactId>infinispan-spring-boot3-starter-embedded</artifactId>
</dependency>

Remote caches

<dependency>
  <groupId>org.infinispan</groupId>
  <artifactId>infinispan-spring-boot3-starter-remote</artifactId>
</dependency>

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.