1.搭建环境:JDK1.8+IDEA2017+Github
2.服务端连接Git配置
2.1.新建一个模块
2.2.导入依赖
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-config-server -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
<version>2.1.1.RELEASE</version>
</dependency>
<!--springboot中自带的监视器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
2.3.编写.yml文件
server:
port: 3344
spring:
cloud:
config:
server:
git:
uri: https://github.com/18526318859/git01.git
application:
name: configserver
2.4.编写启动类
package com.cloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
public class Cloudconfig_server3344 {
public static void main(String[] args) {
SpringApplication.run ( Cloudconfig_server3344.class,args );
}
}