`Deprecated configuration property 'spring.redis.host'`表示配置属性'spring.redis.host'已经过时,不再推荐使用。在Spring框架中,通常过时的配置属性会在后续版本中被删除或替代为新的属性,因此建议不再使用过时的属性,并尽快替换为推荐的新属性设置。
如果你使用了'spring.redis.host'作为Redis主机配置的属性,在最新版本的Spring框架中可能已经被替代为新的属性。
在 Spring Boot 中使用 Redis,有两组配置参数可供选择:spring.redis和spring.data.redis。spring.redis是 Spring Boot 1.x 版本中使用的配置前缀,用于配置与 Redis 相关的参数,如连接地址、端口、密码等。配置文件参数如下:
spring.redis.host=localhost
spring.redis.port=6379
spring.redis.password=mypassword
spring.data.redis则是从 Spring Boot 2.x 版本开始引入的新的配置前缀,也用于配置 Redis 的相关参数。配置文件参数如下:
spring.data.redis.host=localhost
spring.data.redis.port=6379
spring.data.redis.password=mypassword
在 Spring Boot 2.x 及以上的版本中,推荐使用spring.data.redis 进行 Redis 相关的配置。但对于 Spring Boot 1.x 版本仍然可以使用进行配置。