Spring boot 获得;“不允许使用方法”;Spring云总线中POST/执行器/总线刷新时出错

Spring boot 获得;“不允许使用方法”;Spring云总线中POST/执行器/总线刷新时出错,spring-boot,microservices,spring-cloud,spring-boot-actuator,spring-cloud-bus,Spring Boot,Microservices,Spring Cloud,Spring Boot Actuator,Spring Cloud Bus,我使用Spring Cloud Bus和RabbitMQ向一些微服务广播配置更改,但当我点击POST请求时,我得到一个错误“Method Not Allowed”,如下所示: HTTP/1.1 405 Allow: GET Content-Type: application/json Transfer-Encoding: chunked Date: Thu, 26 Mar 2020 05:53:36 GMT Connection: close { "timestamp": "2020-0

我使用Spring Cloud Bus和RabbitMQ向一些微服务广播配置更改,但当我点击POST请求时,我得到一个错误“Method Not Allowed”,如下所示:

HTTP/1.1 405 
Allow: GET
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 26 Mar 2020 05:53:36 GMT
Connection: close

{
  "timestamp": "2020-03-26T05:53:36.872+0000",
  "status": 405,
  "error": "Method Not Allowed",
  "message": "Request method 'POST' not supported",
  "path": "/actuator/bus-refresh"
}
这是我的application.yml文件

server.port: 8888
spring.cloud.config.server.git.uri: E:/Work/git/microservices-poc-using-spring-cloud/config-repo
management:
  endpoints:
    web:
      exposure:
        include: bus-refresh,refresh
但是当我更改曝光属性以允许所有端点时,我得到了一个成功响应,并成功地将更改广播到我的微服务

management:
  endpoints:
    web:
      exposure:
        include: "*"
响应成功

HTTP/1.1 204 
Date: Thu, 26 Mar 2020 05:42:32 GMT
Connection: close
我的pom.xml很简单


4.0.0
org.springframework.boot
spring启动程序父级
2.2.5.1发布
com.sabahallah.microservices
配置服务器
0.0.1-快照
配置服务器
微服务配置服务器
1.8
Hoxton.SR3
org.springframework.cloud
spring云配置服务器
org.springframework.cloud
springcloudstarter总线amqp
org.springframework.boot
弹簧靴起动器执行器
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
org.springframework.cloud
spring云依赖关系
${spring cloud.version}
聚甲醛
进口
org.springframework.boot
springbootmaven插件
而且只有一个java文件

@springboot应用程序
@启用配置服务器
公共类ConfigServerApplication{
公共静态void main(字符串[]args){
run(ConfigServerApplication.class,args);
}
}

嗨,我得到了相同的错误,并通过更改Spring云版本解决了它。 最初我用的是Greenwich.RELEASE

现在我将版本更改为Greenwich.SR1,
Greenwich.SR1

将下面的内容添加到application.properties中为我解决了这个问题

management.endpoints.web.exposure.include=*
或者更具体地说,您可以添加对所需端点的支持

management.endpoints.web.exposure.include=busrefresh

请注意,在旧版本中,它的“总线刷新”功能不支持post/monitor接受帖子并尝试根据vcs Webhook的标题或内容确定要刷新哪些服务。