The following scenario causes double Consul registrations:
spring.cloud.bus.enabled=true
spring.cloud.config.discovery.enabled=true
...
2016-05-06 22:23:54.086 INFO 92515 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-05-06 22:23:54.087 INFO 92515 --- [ main] o.s.c.consul.discovery.ConsulLifecycle : Registering service with consul: NewService{id='consul-bus-double-1324109920', name='consul-bus-double', tags=[], address='192.168.1.6', port=8080, check=Check{script='null', interval=10s, ttl=null, http=http://192.168.1.6:8080/health, timeout=null}}
2016-05-06 22:23:54.104 INFO 92515 --- [ main] o.s.c.consul.discovery.ConsulLifecycle : Registering service with consul: NewService{id='consul-bus-double-912460132', name='consul-bus-double', tags=[], address='192.168.1.6', port=8080, check=Check{script='null', interval=10s, ttl=null, http=http://192.168.1.6:8080/health, timeout=null}}
2016-05-06 22:23:54.110 INFO 92515 --- [ main] io.switchbit.Application : Started Application in 18.38 seconds (JVM running for 18.759)
...
When either spring.cloud.bus.enabled=false
or spring.cloud.config.discovery.enabled=false
and the other is true
then only a single registration (expected) takes place.
...
2016-05-06 22:28:02.542 INFO 92602 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-05-06 22:28:02.542 INFO 92602 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147482647
2016-05-06 22:28:02.603 INFO 92602 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-05-06 22:28:02.607 INFO 92602 --- [ main] o.s.c.consul.discovery.ConsulLifecycle : Registering service with consul: NewService{id='consul-bus-double-1075211196', name='consul-bus-double', tags=[], address='192.168.1.6', port=8080, check=Check{script='null', interval=10s, ttl=null, http=http://192.168.1.6:8080/health, timeout=null}}
2016-05-06 22:28:03.189 INFO 92602 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
...
If you are just using consul for discovery and not configuration, then use
spring-cloud-starter-consul-discovery
. You could also just import one bom if you importedspring-cloud-dependencies:Brixton.RC2
, then you don't have to know1.0.0
vs1.1.0
.