Redis 后端
Spring Cloud Config Server 支持 Redis 作为配置属性的后端。 您可以通过向 Spring Data Redis 添加依赖项来启用此功能。
pom.xml
<dependencies>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-data-redis</artifactId>
	</dependency>
</dependencies>以下配置使用 Spring DataRedisTemplate访问 Redis。我们可以使用spring.redis.*属性以覆盖默认连接设置。
spring:
  profiles:
    active: redis
  redis:
    host: redis
    port: 16379属性应存储为哈希中的字段。哈希的名称应与spring.application.name属性或连词spring.application.name和spring.profiles.active[n].
HMSET sample-app server.port "8100" sample.topic.name "test" test.property1 "property1"运行上面可见的命令后,哈希值应包含以下带有值的键:
HGETALL sample-app
{
  "server.port": "8100",
  "sample.topic.name": "test",
  "test.property1": "property1"
}
| 未指定配置文件时 default将被使用。 |