Spring-cloud Config Server的3种配置方式是怎样的
发表于:2025-11-11 作者:千家信息网编辑
千家信息网最后更新 2025年11月11日,今天就跟大家聊聊有关Spring-cloud Config Server的3种配置方式是怎样的,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获Sp
千家信息网最后更新 2025年11月11日Spring-cloud Config Server的3种配置方式是怎样的
今天就跟大家聊聊有关Spring-cloud Config Server的3种配置方式是怎样的,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获
Spring-cloud Config Server的3种配置
Spring-cloud Config Server 有多种种配置方式,今天我就在此介绍一下Git,local,svn三种配置方式,不过官方文档还是建议使用Git这种方式进行配置开发。
好的,现在开始!!!!!!!
1.config 默认Git加载
通过spring.cloud.config.server.git.uri指定配置信息存储的git地址,比如:https://github.com/xxx/config-repo
2.加载本地开发环境
spring.profiles.active=nativespring.cloud.config.server.native.searchLocations=classpath:/config
3.加载 本地物理环境
spring.profiles.active=nativespring.cloud.config.server.native.searchLocations= file:E:\\Java\\config
4.加载svn环境
http://localhost:8080/{application}/{profile}/{label},比如:http://localhost:8080/dmeo/development/trunk
### config server svnspring.cloud.config.server.svn.uri=http://localhost:8080/dmeo/development/trunkspring.cloud.config.server.svn.username=xxxspring.cloud.config.server.svn.password=xxxspring.profiles.active=subversion
PS: svn 环境 需要 引入 SVN jar包
org.tmatesoft.svnkit svnkit
springcloud统一配置中心(config server 端)
1.为什么要使用统一配置中心?
1.配置不方便维护
2.配置内容的安全性和权限
3.更新配置项目需要重启
2.登陆github 创建一个用于存放配置的项目
3.存放配置的项目的git地址 配置到项目的yml中
4.项目中的配置(Spring Cloud Config server 端)
该项目即是eureka的客户端 又是Config的服务端
4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.2.RELEASE com.zhu config 0.0.1-SNAPSHOT config Demo project for Spring Boot 1.8 Greenwich.RELEASE org.springframework.cloud spring-cloud-config-server org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-test test org.springframework.cloud spring-cloud-dependencies ${spring-cloud.version} pom import org.springframework.boot spring-boot-maven-plugin spring-milestones Spring Milestones https://repo.spring.io/milestone
yml配置
eureka: client: service-url: defaultZone: http://localhost:8085/eureka/server: port: 8090spring: application: name: config cloud: config: server: git: uri: git@github.com:zhujin888/config-repo.git //git地址 username: git的账号 password: git的密码
主类:
package com.zhu.config;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.cloud.client.discovery.EnableDiscoveryClient;import org.springframework.cloud.config.server.EnableConfigServer;@SpringBootApplication@EnableDiscoveryClient@EnableConfigServerpublic class ConfigApplication { public static void main(String[] args) { SpringApplication.run(ConfigApplication.class, args); }}5.再git上创建文件夹 用来存放配置信息
一般存三份
dev:开发test:测试pro:生产
6.访问config server
两种方式: 随便用哪一种
7.把远端的git拉到本地的git来
配置本地 git路径
eureka: client: service-url: defaultZone: http://localhost:8085/eureka/server: port: 8090spring: application: name: config cloud: config: server: git: uri: git@github.com:zhujin888/config-repo.git username: password: basedir: D:\My_Java\anli\gitconfig\basedir //配置本地git路径 把拉下来的配置文件存在这
看完上述内容,你们对Spring-cloud Config Server的3种配置方式是怎样的有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注行业资讯频道,感谢大家的支持。
配置
方式
项目
内容
环境
地址
开发
信息
文件
路径
统一
安全
又是
安全性
官方
客户
客户端
密码
建议
文件夹
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
网页管理域服务器
深圳飞企互联网科技有限公司
数据库主键和外键的作用6
简述软件开发过程审核
数据库怎么检查约束
宿舍网络安全知识宣传
数据库 数据 json
服务器防护是什么
veeamone数据库
软件开发能够做什么工作吗
军营网络安全宣传周板报
无锡电商软件开发条件
dell服务器内存怎么查看真假
山东沃德网络技术电话
华硕服务器设置网卡
软件开发公司申请的科技专项基金
计算机网络技术冗余
英雄联盟重置后找不到服务器
dh数据库百科
崇明区网络安全审计系统咨询辅导
地铁dr服务器
网络软件开发哪个好
竞技世界成都网络技术
青岛奥商网络技术案例
刀箱服务器管理地址怎么重启
山东沃德网络技术电话
java软件开发测试招聘
海康威视后台服务器怎么进入
网络安全的职位
软件开发公司申请的科技专项基金