Skip to content

Commit 4aa82a3

Browse files
committed
Merge pull request #33965 from marcel-wollschlaeger
* gh-33965: Polish "Add Redis application properties example" Add Redis application properties example Closes gh-33965
2 parents 66e1905 + 2bf7802 commit 4aa82a3

File tree

1 file changed

+14
-1
lines changed
  • spring-boot-project/spring-boot-docs/src/docs/asciidoc/data

1 file changed

+14
-1
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,24 @@ TIP: We also provide a `spring-boot-starter-data-redis-reactive` "`Starter`" for
3434
[[data.nosql.redis.connecting]]
3535
==== Connecting to Redis
3636
You can inject an auto-configured `RedisConnectionFactory`, `StringRedisTemplate`, or vanilla `RedisTemplate` instance as you would any other Spring Bean.
37-
By default, the instance tries to connect to a Redis server at `localhost:6379`.
3837
The following listing shows an example of such a bean:
3938

4039
include::code:MyBean[]
4140

41+
By default, the instance tries to connect to a Redis server at `localhost:6379`.
42+
You can specify custom connection details using `spring.redis.*` properties, as shown in the following example:
43+
44+
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
45+
----
46+
spring:
47+
redis:
48+
host: "localhost"
49+
port: 6379
50+
database: 0
51+
username: "user"
52+
password: "secret"
53+
----
54+
4255
TIP: You can also register an arbitrary number of beans that implement `LettuceClientConfigurationBuilderCustomizer` for more advanced customizations.
4356
`ClientResources` can also be customized using `ClientResourcesBuilderCustomizer`.
4457
If you use Jedis, `JedisClientConfigurationBuilderCustomizer` is also available.

0 commit comments

Comments
 (0)