Sync config failed, will retry. Repository class com.ctrip.framework.apollo.i

前言

微服务启动报错

2021-04-06 14:48:29,882 - Sync config failed, will retry. Repository class
com.ctrip.framework.apollo.internals.RemoteConfigRepository, reason: Load Apollo Config failed - appId:
 middle-office-server, cluster: default, namespace: application, url: 
 http://127.0.0.1:8080/configs/middle-office-server/default/application?
 ip=127.0.0.1&messages=%7B%22details%22%3A%7B%22middle-office-server
 %2Bdefault%2Bapplication%22%3A1381%7D%7D [Cause: [status code: 404] Could not find config for namespace - appId: middle-office-server, cluster: default, namespace: application, please check whether the configs are released in Apollo!]

原因

apollo 配置了yml语法

apollo:
  cacheDir: c:/opt/data/
  cluster: default
  meta: http://127.0.0.1:8080
  bootstrap:
    enabled: true
    namespaces: ${server.name},application.yml
    eagerLoad:
      enabled: true

启动器加了这个注解
EnableApolloConfig默认读取的是application.properties 与yml读取冲突后读取了properties

@EnableApolloConfig

Sync config failed, will retry. Repository class com.ctrip.framework.apollo.i_第1张图片

解决

删除 EnableApolloConfig 启动后观察一下 看日志是否还有这个问题

你可能感兴趣的:(后端,微服务,apollo)