Spring Cloud 配置服务器 + BitBucket

Dav*_*lch 5 git spring spring-cloud

我正在尝试使用 BitBucket 私有存储库设置 Spring Cloud 的配置服务器,但没有任何运气。无论我使用什么配置,在尝试加载配置时似乎总是返回 404。

我也尝试过在 中设置断点JGitEnvironmentRepository,但似乎从未在afterPropertiesSet. 如果我在调试时手动触发findOne(application,profile,label),则会收到错误消息Branch name <null> not allowed。如果我为属性指定“master” label,那么我会收到可怕的Ref master cannot be resolved错误。

该应用程序加载正常,但没有结果。从我读过的所有文档来看,这似乎应该是开箱即用的。任何帮助,将不胜感激。

bootstrap.yml

server:
  port: 8888

spring:
  application:
    name: config-service
  cloud:
    bus.amqp.enabled: false
    config:
      enabled: false
      failFast: true
      server:
        prefix: /configs
        git :
          uri: https://bitbucket.org/[team]/[repo].git
          username: [user]
          password: [pass]
Run Code Online (Sandbox Code Playgroud)

回购文件

- demo.app.yml
Run Code Online (Sandbox Code Playgroud)

尝试的网址

http://localhost:8888/configs/demo.app

Tyu*_*tyu 2

  1. 您需要在 url 中添加配置文件名称。默认配置文件是“默认”。http://localhost:8888/configs/demo.app/default

  2. 这仅适用于 1.0.0.RELEASE 版本,但对于 1.0.1.RELEASE 版本,我在 Windows 上发现了一个问题(文件分隔符存在问题,因此配置服务器在中找不到 YAML 文件)本地克隆存储库)。也许这是相关的问题:Spring Cloud Config | 基于 Git | 无法在 Windows 机器上运行