Merge branch '2.7.x' into 3.0.x

Closes gh-34041
This commit is contained in:
Andy Wilkinson 2023-02-01 15:46:03 +00:00
commit 0184548be1

View File

@ -34,11 +34,25 @@ TIP: We also provide a `spring-boot-starter-data-redis-reactive` "`Starter`" for
[[data.nosql.redis.connecting]]
==== Connecting to Redis
You can inject an auto-configured `RedisConnectionFactory`, `StringRedisTemplate`, or vanilla `RedisTemplate` instance as you would any other Spring Bean.
By default, the instance tries to connect to a Redis server at `localhost:6379`.
The following listing shows an example of such a bean:
include::code:MyBean[]
By default, the instance tries to connect to a Redis server at `localhost:6379`.
You can specify custom connection details using `spring.data.redis.*` properties, as shown in the following example:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
data:
redis:
host: "localhost"
port: 6379
database: 0
username: "user"
password: "secret"
----
TIP: You can also register an arbitrary number of beans that implement `LettuceClientConfigurationBuilderCustomizer` for more advanced customizations.
`ClientResources` can also be customized using `ClientResourcesBuilderCustomizer`.
If you use Jedis, `JedisClientConfigurationBuilderCustomizer` is also available.