org.springframework.cloud:spring-cloud-starter-consul-discovery

Spring Cloud Starter Consul Discovery


Keywords
cloud-native, configuration, consul, java, microservices, service-discovery, spring, spring-boot, spring-cloud, spring-cloud-core
License
Apache-2.0

Documentation

Actions Status
Codecov

Quick Start

Consul overview

Features of Consul

  • Distributed configuration

  • Service registration and discovery

  • Distributed events

  • Distributed locking and sessions

  • Supports multiple data centers

  • Built in, user-friendly user interface

See the intro for more information.

Spring Cloud Consul Features

  • Spring Cloud DiscoveryClient implementation

    • supports Spring Cloud Gateway

    • supports Spring Cloud LoadBalancer

  • Consul based PropertySource loaded during the 'bootstrap' phase.

  • Spring Cloud Bus implementation based on Consul events

Running the sample

  1. Run docker-compose up

  2. Verify consul is running by visiting http://localhost:8500

  3. Run mvn package this will bring in the required spring cloud maven repositories and build

  4. Run java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-${VERSION}.jar

  5. visit http://localhost:8080, verify that {"serviceId":"<yourhost>:8080","host":"<yourhost>","port":8080} results

  6. run java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-${VERSION}.jar --server.port=8081

  7. visit http://localhost:8080 again, verify that {"serviceId":"<yourhost>:8081","host":"<yourhost>","port":8081} eventually shows up in the results in a round robbin fashion (may take a minute or so).

Building

Building

Contributing

Contributing