• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

?可扩展标记语言版本='1.0 '编码='UTF八号'?

项目xmlns=' http://maven。阿帕奇。org/POM/4。0 .0 ' xmlns : xsi=' http://www。w3。' org/2001/XML架构-实例'

xsi :架构位置=' http://maven。阿帕奇。org/POM/4。0 .0 https://maven.apache.org/xsd/maven-4.0.0.xsd'

型号版本4 .0 .0/型号版本

groupIdcom.msb/groupId

artifactId spring-cloud-config/artifactId

版本0 .0 .1-快照/版本

namespring-cloud-config/name

描述Spring Boot的演示项目/描述

性能

Java。1.8版/java.version

项目。建造。sourceencodingutf-8/项目。建造。信源编码

项目。报道。outputencodingtf-8/项目。报道。输出编码

spring-boot.version2.3.7.RELEASE/spring-boot.version

春云。版本号

/属性

属国

属国

groupIdorg.springframework.boot/groupId

artifact id spring-boot-starter-web/artifact id

/依赖关系

属国

groupIdorg.springframework.cloud/groupId

artifact id spring-cloud-config-server/artifact id

/依赖关系

属国

groupIdorg.springframework.cloud/groupId

人工春-云-启动器-网飞-尤里卡-客户端/artifactId

/依赖关系

属国

groupIdorg.springframework.boot/groupId

artifactId spring-boot-starter-test/artifactId

范围测试/范围

不包括的项目:如接受服务项目是由投保以前已患有的疾病或伤害引致的

排除

groupIdorg.junit.vintage/groupId

artifactId JUnit-vintage-engine/artifactId

/排除

/排除

/依赖关系

/依赖关系

依赖性管理

ment> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.7.RELEASE</version> <configuration> <mainClass>com.msb.SpringCloudConfigApplication</mainClass> </configuration> <executions> <execution> <id>repackage</id> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
@SpringBootApplication
@EnableDiscoveryClient
@EnableConfigServer
public class SpringCloudConfigApplication {
    
    public static void main(String[] args) {
        SpringApplication.run(SpringCloudConfigApplication.class, args);
    }
    
}
spring:
  application:
    name: spring-cloud-config
  cloud:
    config:
      server:
        git:
          uri: https://github.com/lcccher/Spring-cloud-config.git
      label: dev
eureka:
  client:
    service-url:
      defaultZone: http://localhost:7900/eureka/
server:
  port: 9090

ysswmctqgut4112.png

 

 5lko4wthxrn4113.png

 

 f1g22etexzp4114.png

 

 dzb5uicgbaf4115.png

 

---------------------------------------------------------------------------------------------

 x2ap3lv3mmd4116.png

 

 jon2w5q2t1l4117.png

 

 kzbkpbei2mz4118.png

 

 

@RestController
public class TestController {
    
    @Value("${name}")
    String name;
    
    @GetMapping
    public String getName(){
        
        return name;
    }
    
}
配置一定要改成bootstrap 格式  要先加载这个配置文件 再去读取    该文件相当于   拉取了server 端的config   server 端的config 是拉取了github上面的配置文件
spring: application: name: spring-cloud-config-client cloud: config: label: test uri: http://localhost:9090/ profile: test eureka: client: service-url: defaultZone: http://localhost:7900/eureka/ server: port: 9091
https://blog.csdn.net/qq_43792385/article/details/104700128

 

Link to comment
Share on other sites