config服务器本机概要文件问题

y53ybaqx  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(182)

我已经将SpringCloud版本从hoxton.sr9升级到2020.0.0(SpringBootVersion2.4.0以后的版本)。
我正在使用本机配置文件从资源文件夹读取配置。

spring:
  application:
    name: config-server
  profiles:
    active: native

  cloud:
    config:
      server:
        native:
          search-locations: classpath:/config/form-service, classpath:/config/tpm-admin-service, classpath:/config/tpm-service, classpath:/config/tpm-api-gateway-admin, classpath:/config/tpm-api-gateway-app, classpath:/config/sdc-service, classpath:/config/sdc-api-gateway-app, classpath:/config/sdc-admin-service, classpath:/config/sdc-api-gateway-admin, classpath:/config/attachment-service, classpath:/config/fds-service, classpath:/config/fds-admin-service, classpath:/config/fds-api-gateway-admin, classpath:/config/fds-api-gateway-app, classpath:/config/onboarding-service

server:
  port: ${config_server_port:8888}

升级后,配置服务器启动出现以下错误:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-27 18:02:58.523 ERROR 4552 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************

APPLICATION FAILED TO START

***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

我也尝试过使用复合配置文件(如下所示),但似乎没有任何效果。

spring:
  application:
    name: config-server
  profiles:
    active: composite

  cloud:
    config:
      server:
        composite:
        - type: native
          search-locations: classpath:/config/form-service, classpath:/config/tpm-admin-service, classpath:/config/tpm-service, classpath:/config/tpm-api-gateway-admin, classpath:/config/tpm-api-gateway-app, classpath:/config/sdc-service, classpath:/config/sdc-api-gateway-app, classpath:/config/sdc-admin-service, classpath:/config/sdc-api-gateway-admin, classpath:/config/attachment-service, classpath:/config/fds-service, classpath:/config/fds-admin-service, classpath:/config/fds-api-gateway-admin, classpath:/config/fds-api-gateway-app, classpath:/config/onboarding-service
        bootstrap: true

server:
  port: ${config_server_port:8888}

另外,使用spring初始化器下载的项目也面临类似的问题。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题