我使用spring cloud bus和rabbitMQ来刷新spring配置 . 当我们更新配置并推送到github时,webhook无法刷新,响应消息:

“{”timestamp“:”2018-05-14T09:44:48.230 0000“,”status“:400,”error“:”错误请求“,”消息“:”JSON解析错误:无法反序列化java实例 . lang.String out of START_ARRAY token;嵌套异常是com.fasterxml.jackson.databind.exc.MismatchedInputException:无法在[Source:(PushbackInputStream); START_ARRAY token \ n中反序列化java.lang.String的实例 . line:1,column:290](通过引用链:java.util.LinkedHashMap [\“commits \”])“,”path“:”/ actuator / bus-refresh“}”;

但是当我们通过邮递员或使用命令“curl -X POST http://436d3d0b.ngrok.io/actuator/bus-refresh”刷新时,它可以正常刷新 .

application.yml如下图所示:

spring :

应用:

name: config-server

Cloud :

config:
  server:
    git:
      search-paths: config/*
      username:
      password:
      uri: "github url"
  label: master
bus:
  trace:
    enabled: true

RabbitMQ的:

host: localhost
port: 5672
username: guest
password: guest

管理:

终点:

web:
  exposure:
    include: bus-refresh

Github webhook有效负载网址为“http://436d3d0b.ngrok.io/actuator/bus-refresh " and content type is " application / json”;