[id='setting-up-spring-cache_{context}']
= Setting up Spring caching with {brandname}

Add the {brandname} dependencies to your Spring application project.
If you use remote caches in a {brandname} Server deployment, you should also configure your Hot Rod client properties.

[IMPORTANT]
====
{brandname} only supports Spring version version 6.
====

.Procedure
. Add {brandname} and the Spring integration module to your `pom.xml`.
+
* Remote caches: `infinispan-spring6-remote`
* Embedded caches: `infinispan-spring6-embedded`
+
[TIP]
====
Spring Boot users can add the following artifacts instead of the `infinispan-spring6-embedded`:

* For Spring Boot 3 add `infinispan-spring-boot3-starter-embedded`
====
. Configure your Hot Rod client to connect to your {brandname} Server deployment in the `hotrod-client.properties` file.
+
[source,xml,options="nowrap",subs=attributes+]
----
include::properties/hotrod-client-remote.properties[]
----

[discrete]
== Spring Cache dependencies

.Remote caches
[source,xml,options="nowrap",subs=attributes+,role="primary"]
----
include::dependencies_maven/spring_cache_remote.xml[]
----

.Embedded caches
[source,xml,options="nowrap",subs=attributes+,role="secondary"]
----
include::dependencies_maven/spring_cache_embedded.xml[]
----

[role="_additional-resources"]
.Additional resources
* link:{hotrod_docs}#configuring-hotrod-java-clients_hotrod-client-configuration[Configuring Hot Rod Client connections]
