网络编程
位置:首页>> 网络编程>> 网络编程>> Config服务端连接Git配置的技巧

Config服务端连接Git配置的技巧

作者:为BUG消得人憔悴  发布时间:2023-03-12 02:32:59 

标签: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

来源:https://blog.csdn.net/weixin_43612925/article/details/120269249

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com