首页 /  技术专区  /  SpringCloud 宽屏模式 >

Config:服务端链接Git配置

1.新建项目springcloud-config-server-3344

image.png

2.引入依赖

image.png

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>springcloud</artifactId>
        <groupId>com.allen</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>springcloud-config-server-3344</artifactId>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <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>
    </dependencies>


</project>

3.编写配置文件application.yml

image.png

server:
  port: 3344

spring:
  application:
    name: springcloud-config-server
    #链接远程仓库
  cloud:
    config:
      server:
        git:
          uri: https://gitee.com/liqinglin0314/springcloud-config.git

4.编辑启动类

image.png

5.启动服务测试

image.png

image.png

image.png



头像
0/200
图片验证码