引入配置中心模块
导入依赖
<!--config-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<!--actuator完善监控信息-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
编写配置文件,需要创建远程仓库,用于存放配置文件
server:
port: 3344
spring:
application:
name: springcloud-config-server
# 连接远程仓库
cloud:
config:
server:
git:
uri: https://e.coding.net/shsany/kuangdengguanlipingtai/springcloud-config.git
# 通过config-server可以连接到git,访问其中的资源以及配置
开启相关功能
@SpringBootApplication
@EnableConfigServer
public class Config_Server_3344 {
public static void main(String[] args) {
SpringApplication.run(Config_Server_3344.class, args);
}
}
标签:git,spring,boot,server,SpringCloud,config,cloud,分布式
From: https://www.cnblogs.com/singob/p/16718371.html