Spring boot config registry [Spring boot config 配置中心]
Spring boot config Server
- 添加依赖
<!-- config server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
- 启用
启动类添加 @EnableConfigServer 注解
- 配置文件
spring:
cloud:
config:
server:
git:
# git/svn/file system. example: https://gitee.com/[your git repsitory].git
uri: [your git repository]
# 配置文件所在路径
search-paths: profiles
# git 用户名 & 密码, 如public项目, 可省略
username:
password:
# 如不加该前缀,spring boot start config 会拦截根url下静态资源
prefix: /config
# 配置文件所在分支
label: master
# 仅作为配置中心使用,不会更新远程配置
enabled: false
- 使用方式