Spring Cloud 升级到 2020.0.0 后配置服务器本机配置文件问题

时间:2021-01-27 12:47:53

标签: java spring spring-boot native profile

我已将 Spring Cloud 版本从 Hoxton.SR9 升级到 2020.0.0(Spring Boot 版本 2.4.0 以后)。< /p>

我正在使用 native 配置文件从资源文件夹中读取配置。

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}

升级后,config-server启动报错如下:

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.

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

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 initializer 下载的项目面临类似问题。

0 个答案:

没有答案
相关问题