Add Redis application properties example

For the `Connect to Redis` section in the documentation also mention how
to configure the Redis connection via application properties similar
to the other connectors (Mongodb, Elasticsearch, Neo4j, ...).

See gh-33965
This commit is contained in:
Marcel Wollschläger 2023-01-24 14:22:43 +01:00 committed by Andy Wilkinson
parent 66e1905d17
commit b6f900dd98
1 changed files with 13 additions and 0 deletions

View File

@ -48,7 +48,20 @@ If you add your own `@Bean` of any of the auto-configured types, it replaces the
By default, a pooled connection factory is auto-configured if `commons-pool2` is on the classpath.
Alternatively, you can specify connection details using discrete properties.
For example, you might declare the following settings in your `application.properties`:
[source,yaml,indent=0,subs="verbatim",configprops,configblocks]
----
spring:
data:
redis:
host: "localhost"
port: 6379
database: 0
username: "user"
password: "secret"
----
[[data.nosql.mongodb]]
=== MongoDB