一、config-server git
https://github.com/huanzi-qch/config-server/blob/master/myspringboot-dev.properties
二、configServer
1、pom.xml
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.5</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
2、application.properties
spring.application.name=cs2063
server.port=2063
spring.cloud.config.server.git.uri=https://github.com/huanzi-qch/config-server.git
spring.cloud.config.server.git.search-paths=config-server
spring.cloud.config.label=master
[email protected]
spring.cloud.config.server.git.password=kkksss
3、CserverApplication
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer;
@EnableConfigServer
@SpringBootApplication
public class CserverApplication {
public static void main(String[] args) {
SpringApplication.run(CserverApplication.class, args);
}
}
4、http://localhost:2063/myspringboot-dev.properties/
参考
https://www.cnblogs.com/huanzi-qch/p/10149547.html
标签:git,spring,springframework,server,cs,sc,20230108,config,cloud From: https://www.cnblogs.com/smallfa/p/17059290.html