首页 > 解决方案 > Spring Cloud Config 的大小限制是多少?

问题描述

我们正在使用 Spring Boot、Spring Cloud 配置并从外部源生成 application.yaml。这个 yaml 文件有大约 53k 行配置,文件大小为 2.7mb。不幸的是,当连接到这个配置时,spring 应用程序无法启动。

我设法将 yaml 文件输入本地 Spring Cloud Config 服务器,并通过 http://localhost:8888/mybranch/myApp-application.properties 之类的 url 请求表示。

但是当我通过它启动我的 Spring Boot 应用程序时,mvn clean spring-boot:run -Dspring-boot.run.profiles=local它会在启动过程中停止。

事实上,它在从云配置服务器获取 yaml后停止。如您所见,初始化过滤器“apiKeyHeaderFilter”大约需要 2 分钟。但在那之后它停止了。

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.3.RELEASE)

2019-03-28 21:06:01.264  INFO 43213 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2019-03-28 21:06:05.129  INFO 43213 --- [           main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=myApp, profiles=[local], label=mybranch, version=99fd22b9273e757c2afad36deec40442c2cdb69a, state=null
2019-03-28 21:06:05.130  INFO 43213 --- [           main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='/Users/me/dev/projects/mam/repos/myApp-configs/application.yaml'}]}
2019-03-28 21:06:10.506  INFO 43213 --- [           main] c.m.forms.application.Application        : The following profiles are active: local
2019-03-28 21:08:04.864 DEBUG 43213 --- [ost-startStop-1] c.m.m.c.a.ApiKeyHeaderFilter             : Initializing filter 'apiKeyHeaderFilter'
2019-03-28 21:08:04.865 DEBUG 43213 --- [ost-startStop-1] c.m.m.c.a.ApiKeyHeaderFilter             : Filter 'apiKeyHeaderFilter' configured successfully 

我已经尝试从具有更大堆大小但结果相同的应用程序开始:mvn clean spring-boot:run -Dspring-boot.run.profiles=local -Drun.jvmArguments="-Xms1024m"

我的设置是否达到了大小限制或配置阈值行?

编辑: myApp 的相关部分也bootstrap.yaml如下所示:

spring:
  profiles: local
  cloud:
    config:
      enabled: true
      label: mybranch
      uri: http://localhost:8888

标签: javaspring-bootspring-cloud-configspring-config

解决方案


推荐阅读