The configuration center config, direct access to the remote yml file is empty?

First review the configuration method of config server:
1. Guide package

<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-config-server</artifactId>
	</dependency>

2. Start class write @EnableConfigServer
3. Configure yml file

server:
  port: 8090
spring:
  application:
    name: config-demo
  cloud:
    config:
      server:
        git:
          uri: https://gitee.com/liaochaoxxx/configuration_file.git
      这样就可以启动并通过:http://localhost:8090/common-dev.yml去访问到common-dev.yml文件

Note that there is a pit here: I have been visiting for a long time and the return is empty. I can't find the reason, and later found out

spring:
  application:
    name: lpp-config  #服务名称
 profiles:
    active: native  # 配置使用本地储存

#Note here:
profiles:
active: native # The configuration uses local storage.
It is only accessed locally, not remotely. So I can't visit.
If you put the configuration file in the local folder during the test, you need to configure this.
If you go to the remote (gitee), you need to delete this, otherwise you will not be able to access.
Also: make sure that the content on the remote (gitee) is public

Published 67 original articles · Liked12 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/m0_37635053/article/details/103489934