我是靠谱客的博主 知性火,这篇文章主要介绍Config服务端连接Git配置的技巧,现在分享给大家,希望可以做个参考。

Config:服务端连接Git配置,代码如下所示:

1、导入依赖

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
</dependencies>

2、编写配置文件

server:
  port: 3344
spring:
  application:
    name: Git-config-3344
  #连接远程仓库
  cloud:
    config:
      server:
        git:
          uri: https://gitee.com/xiao-yunshan/gittest.git

3、编写启动类

@SpringBootApplication
@EnableConfigServer
public class Git_3344 {
    public static void main(String[] args) {
        SpringApplication.run(Git_3344.class,args);
    }
}

4、启动访问

http://localhost:3344/application-dev.yml

到此这篇关于Config服务端连接Git配置的技巧的文章就介绍到这了,更多相关Config服务端连接Git配置内容请搜索靠谱客以前的文章或继续浏览下面的相关文章希望大家以后多多支持靠谱客!

最后

以上就是知性火最近收集整理的关于Config服务端连接Git配置的技巧的全部内容,更多相关Config服务端连接Git配置内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(155)

评论列表共有 0 条评论

立即
投稿
返回
顶部