我试图通过BitBucket私有存储库获取Spring Cloud的Config Server设置并且没有任何运气。无论我使用什么配置,我总是在尝试加载配置时返回404。
我还尝试在JGitEnvironmentRepository
中设置断点,但似乎永远不会在afterPropertiesSet
之外调用。如果我在调试时手动触发findOne(application,profile,label)
,则会收到Branch name <null> not allowed
的错误。如果我指定&#34; master&#34;对于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]
回复文件
- demo.app.yml
尝试过的网址
答案 0 :(得分:2)
您需要在网址中添加个人资料名称。默认配置文件为&#39;默认&#39;。 http://localhost:8888/configs/demo.app/default
这只适用于我的1.0.0.RELEASE版本,但是使用1.0.1.RELEASE版本我在Windows上发现了一个问题(文件分隔符存在问题,因此配置服务器没有&# 39;在本地克隆的存储库中找到YAML文件。也许这是相关问题:Spring Cloud Config | Git Based | Not working on windows machine
答案 1 :(得分:1)
如果您仍有任何问题,可以参考以下客户端配置。我已经成功配置了bitbucket存储库。
Spring Boot Version: 1.4.1.RELEASE
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Camden.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
-----------------------------------------------------------------------
bootstrap.yml
spring:
application:
name: client-config
cloud:
config:
failFast: true
label: master
profile: default
username: <username>
password: <password>
server:
bootstrap: true
uri: http://localhost:8888