在我的Spring Cloud配置服务器pom.xml中

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.0.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <spring-cloud.version>Finchley.M8</spring-cloud.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-monitor</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-amqp</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-bus</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-config-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-stream-binder-rabbit</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

在bootstrap.properties中,我使用spring.cloud.config.server.git.uri指定了存储库以从(作为yml文件)获取配置属性 . 我已经设置了一个Github webhook,并将ngrok转发POST请求发送到配置服务器正在侦听的端口8888 . 当我提交对yml配置文件的更改时,一切似乎都按预期进行:

  • 在ngrok控制台窗口中,有一个POST请求/监视和响应200 .

  • 在Github的webhook管理页面上标记成功 .

  • 在配置服务器的控制台窗口中创建以下日志条目 .

2018-03-14 13:55:03.023  INFO 17004 --- [nio-8888-exec-3] o.s.c.c.monitor.PropertyPathEndpoint     : Refresh for: develop_localhost
2018-03-14 13:55:04.451  INFO 17004 --- [nio-8888-exec-3] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2018-03-14 13:55:04.483  INFO 17004 --- [nio-8888-exec-3] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@d3f5ec1: startup date [Wed Mar 14 13:55:04 EET 2018]; root of context hierarchy
2018-03-14 13:55:04.521  INFO 17004 --- [nio-8888-exec-3] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$5a4e4f18] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-03-14 13:55:06.027  INFO 17004 --- [nio-8888-exec-3] o.s.cloud.commons.util.InetUtils         : Cannot determine local hostname
2018-03-14 13:55:06.041  INFO 17004 --- [nio-8888-exec-3] o.s.boot.SpringApplication               : No active profile set, falling back to default profiles: default
2018-03-14 13:55:06.043  INFO 17004 --- [nio-8888-exec-3] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@429eafc3: startup date [Wed Mar 14 13:55:06 EET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@d3f5ec1
2018-03-14 13:55:06.053  INFO 17004 --- [nio-8888-exec-3] o.s.boot.SpringApplication               : Started application in 3.024 seconds (JVM running for 97.323)
2018-03-14 13:55:06.054  INFO 17004 --- [nio-8888-exec-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@429eafc3: startup date [Wed Mar 14 13:55:06 EET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@d3f5ec1
2018-03-14 13:55:06.055  INFO 17004 --- [nio-8888-exec-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@d3f5ec1: startup date [Wed Mar 14 13:55:04 EET 2018]; root of context hierarchy
2018-03-14 13:55:06.128  INFO 17004 --- [nio-8888-exec-3] o.s.cloud.bus.event.RefreshListener      : Received remote refresh request. Keys refreshed []

为什么键列表刷新为空?当我检查本地属性源yml文件时,在Github上提交的更改和POST到监视器 endpoints 的更改也不会反映在那里 . 我在本地网络中的另一台服务器上运行RabbitMQ,我可以在其Web管理控制台上看到配置服务器和为其创建的通道的连接 . 但概述选项卡上没有消息 .

在嵌入式Tomcat / Jetty设法启动的情况下,这曾经与Spring Boot 1.5.4.RELEASE和Spring Cloud Dalston.SR5一起使用 . 尝试版本升级的主要原因是servlet容器实际上只启动了10%的启动 . 现在使用Spring Boot 2.0.0.RELEASE和Spring Cloud Finchley.M8,Tomcat总是启动,但配置更改似乎没有传播到配置服务器,绝对不会传播到RabbitMQ .

有任何想法吗?

Edit June 5th, 2018. 现在我已经在配置服务器pom.xml中将spring-boot-starter-parent更新为2.0.2.RELEASE,配置客户端从中获取配置 . 但和以前一样,没有推送通知传播到RabbitMQ . 配置服务器和客户端都有各自的连接,通道和RabbitMQ队列 .

现在,如果我将spring-cloud.version更改为Finchley.BUILD-SNAPSHOT或Finchley.RC2(并保留Spring Boot 2.0.2.RELEASE或将其更改为2.0.1.RELEASE,没有区别),我可以看到来自的排队消息RabbitMQ Web管理控制台收到推送通知时的配置服务器 . 精细 . 组合的缺点是,当配置客户端尝试从服务器获取其设置时,服务器会记录下面的异常

2018-06-04 16:16:12.352 ERROR 10428 --- [nio-8888-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot load environment] with root cause

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(Unknown Source) ~[na:1.8.0_144]
    at org.springframework.cloud.config.server.environment.HttpClientConfigurableHttpConnectionFactory.lookupHttpClientBuilder(HttpClientConfigurableHttpConnectionFactory.java:69) ~[spring-cloud-config-server-2.0.0.BUILD-SNAPSHOT.jar!/:2.0.0.BUILD-SNAPSHOT]

并且因为客户端没有得到它的配置,它无法启动 .

Spring Boot和Cloud版本的工作组合是什么,以便完整的RabbitMQ集成(消息传播到RabbitMQ)以及成功的配置服务器和客户端交互?就像我之前提到的,这曾经与Spring Boot 1.5.4.RELEASE和Spring Cloud Dalston.SR5一起使用,但降级到它们不是一种选择 .