2017-05-01 52 views

回答

2

由於git沒有事件,你需要使用你的git服務器的webhooks。見http://cloud.spring.io/spring-cloud-static/Camden.SR6/#_push_notifications_and_spring_cloud_bus

在配置服務器添加

<parent> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-parent</artifactId> 
    <version>Camden.SR6</version> 
    <relativePath /> <!-- lookup parent from repository --> 
</parent> 
<dependencies> 
    <dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-config-monitor</artifactId> 
    </dependency> 
    <dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-bus-amdp</artifactId> 
    <!-- -amqp (rabbitmq) or -kafka --> 
    </dependency> 
<!-- ... --> 
</dependencies> 

然後您需要一個網絡掛接添加到您的配置服務器http://<configserverurl>/monitor

在配置客戶端添加

<dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-config</artifactId> 
</dependency> 
<dependency> 
    <groupId>org.springframework.cloud</groupId> 
    <artifactId>spring-cloud-starter-bus-amqp</artifactId> 
    <!-- -amqp (rabbitmq) or -kafka --> 
</dependency> 

更多詳細的https://spencergibb.netlify.com/blog/2015/09/24/spring-cloud-config-push-notifications/

+0

第二個什麼@spencergibb上面提到的,我也曾經對此進行了博客:http://tech.asimio.net/2017/02/02/Refreshable-Configuration-using-Spring-Cloud-Config-Server-Spring-Cloud-Bus-RabbitMQ-and-Git html的 – ootero

相關問題