SpringCloud config 错误 springcloud config Could not resolve placeholder 'config.info' in value "${...

一、 springcloud config Could not resolve placeholder 'config.info' in value "${config.info}

yml格式错误.png

解决问题

我的原因是仓库yml文件格式不正确,所以不推荐直接远程仓库文件中编辑

二、config服务端配置

1、pom


    
        
        
            org.springframework.cloud
            spring-cloud-config-server
        
        
        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
        
        
        
            org.springframework.boot
            spring-boot-starter-web
        
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            org.apache.commons
            commons-lang3
        
        
        
            org.springframework.boot
            spring-boot-devtools
            runtime
            true
        

    

2、LKTYConfigCenterApplication

@EnableConfigServer
@EnableEurekaClient
@SpringBootApplication
public class LKTYConfigCenterApplication {

    public static void main(String[] args) {
        SpringApplication.run(LKTYConfigCenterApplication.class, args);
    }

}

3、application.yml

server:
  port: 1314

spring:
  application:
    name: config-center
  cloud:
    config:
      server:
        git:
          # GitHub上面的git仓库名字
#          uri: [email protected]:zjqx1991/springcloud-config.git
          uri: https://github.com/zjqx1991/springcloud-config.git
          # 搜索目录
          search-paths: /
      #            - springcloud-config
      # 读取分支
      label: master

eureka:
  client:
    fetch-registy: true
    register-with-eureka: true # 表示是否将自己注册进 EurekaServer 默认为true
    fetchRegistry: true # 是否从EurekaServer 抓取已有的注册信息,默认为true。单节点无所谓,集群必须设置为true 才能配合ribbon使用负载均衡
    service-url:
      defaultZone: http://localhost:10086/eureka

  # 设置feign客户端超时时间(openFeign默认支持ribbon)
  #ribbon:
  #  eager-load:
  #    enabled: true
  #    clients: SERVER-PAYMENT
  # 指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间
  #  ReadTimeout: 5000
  # 指的是建立连接后从服务器读取到可用资源所用的时间
#  ConnectTimeout: 5000

feign:
  hystrix:
    enabled: true
#  httpclient:
#    # 开启 Http Client
#    enabled: true
#    # 最大连接数,默认:200
#    max-connections: 200
#    # 最大路由,默认:50
#    max-connections-per-route: 50
#    # 连接超时,默认2000/ms
#    connection-timeout: 2000
#    # 生成时间,默认:900
#    time-to-live: 900

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 6000 # 设置hystrix的超时时间为6000ms

三、config-client端配置

1、pom


    
        
        
            org.springframework.cloud
            spring-cloud-starter-config
        
        
        
            org.springframework.cloud
            spring-cloud-starter-netflix-eureka-client
        
        
        
            org.springframework.boot
            spring-boot-starter-web
        
        
        
            org.springframework.boot
            spring-boot-starter-actuator
        
        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            org.apache.commons
            commons-lang3
        
        
        
            org.springframework.boot
            spring-boot-devtools
            runtime
            true
        

    

2、LKTYConfigClientApplication

@EnableEurekaClient
@SpringBootApplication
public class LKTYConfigClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(LKTYConfigClientApplication.class, args);
    }

}

3、bootstrap.yml

server:
  port: 1315

spring:
  application:
    name: config-client
  cloud:
    config: # Config客户端配置
      label: master #分支名称
      name: config  #配置文件名称
      profile: dev  #读取后缀名称 master分支上 config-dev.yml
      uri: http://localhost:1314

eureka:
  client:
    fetch-registy: true
    register-with-eureka: true # 表示是否将自己注册进 EurekaServer 默认为true
    fetchRegistry: true # 是否从EurekaServer 抓取已有的注册信息,默认为true。单节点无所谓,集群必须设置为true 才能配合ribbon使用负载均衡
    service-url:
      defaultZone: http://localhost:10086/eureka

  # 设置feign客户端超时时间(openFeign默认支持ribbon)
  #ribbon:
  #  eager-load:
  #    enabled: true
  #    clients: SERVER-PAYMENT
  # 指的是建立连接所用的时间,适用于网络状况正常的情况下,两端连接所用的时间
  #  ReadTimeout: 5000
  # 指的是建立连接后从服务器读取到可用资源所用的时间
#  ConnectTimeout: 5000

feign:
  hystrix:
    enabled: true
#  httpclient:
#    # 开启 Http Client
#    enabled: true
#    # 最大连接数,默认:200
#    max-connections: 200
#    # 最大路由,默认:50
#    max-connections-per-route: 50
#    # 连接超时,默认2000/ms
#    connection-timeout: 2000
#    # 生成时间,默认:900
#    time-to-live: 900

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 6000 # 设置hystrix的超时时间为6000ms


你可能感兴趣的:(SpringCloud config 错误 springcloud config Could not resolve placeholder 'config.info' in value "${...)