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
DiscoveryClientimplementationsupports Spring Cloud Gateway
supports Spring Cloud LoadBalancer
Consul based
PropertySourceloaded during the 'bootstrap' phase.Spring Cloud Bus implementation based on Consul events
Run
docker-compose upVerify consul is running by visiting http://localhost:8500
Run
mvn packagethis will bring in the required spring cloud maven repositories and buildRun
java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-${VERSION}.jarvisit http://localhost:8080, verify that
{"serviceId":"<yourhost>:8080","host":"<yourhost>","port":8080}resultsrun
java -jar spring-cloud-consul-sample/target/spring-cloud-consul-sample-${VERSION}.jar --server.port=8081visit 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).
Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/building.adoc - include::partial$building.adoc[]
Unresolved directive in https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/docs/modules/ROOT/pages/contributing.adoc - include::partial$contributing.adoc[]