-
Notifications
You must be signed in to change notification settings - Fork 540
Description
Bug report
Application configuration context is not refreshing after updates in consul, as it was springboot 1.5.9 and spring cloud consul Edgware.RELEASE.
In order to verify that issue is not with my app, I generated 2 projects in http://start.spring.io with dependencies: Consul configuration, Consul Discovery, Web
https://github.com/olehlesiuk/demo-spring-boot-1.5.9
added to generated configuration:
@EnableDiscoveryClient and config file bootstrap.properties with
spring.application.name=s1pconsuldemo
2018-02-13 07:38:06.321 INFO 13910 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8081 (http)
2018-02-13 07:38:06.340 INFO 13910 --- [ main] o.s.c.c.s.ConsulServiceRegistry : Registering service with consul: NewService{id='s1pconsuldemo-8081', name='s1pconsuldemo', tags=[], address='192.168.1.112', port=8081, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://192.168.1.112:8081/health', tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null}
2018-02-13 07:38:06.371 INFO 13910 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 4.236 seconds (JVM running for 7.079)
2018-02-13 07:38:13.685 INFO 13910 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-02-13 07:38:13.686 INFO 13910 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-02-13 07:38:13.700 INFO 13910 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 14 ms
2018-02-13 07:39:19.774 INFO 13910 --- [pool-1-thread-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1967c7cf: startup date [Tue Feb 13 07:39:19 CET 2018]; root of context hierarchy
2018-02-13 07:39:19.794 INFO 13910 --- [pool-1-thread-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-02-13 07:39:19.808 INFO 13910 --- [pool-1-thread-1] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$511517b1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-13 07:39:19.909 INFO 13910 --- [pool-1-thread-1] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource [name='consul', propertySources=[ConsulPropertySource {name='config/s1pconsuldemo/'}, ConsulPropertySource {name='config/application/'}]]
2018-02-13 07:39:19.911 INFO 13910 --- [pool-1-thread-1] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2018-02-13 07:39:19.912 INFO 13910 --- [pool-1-thread-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1f7f216f: startup date [Tue Feb 13 07:39:19 CET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1967c7cf
2018-02-13 07:39:19.917 INFO 13910 --- [pool-1-thread-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-02-13 07:39:19.933 INFO 13910 --- [pool-1-thread-1] o.s.boot.SpringApplication : Started application in 0.192 seconds (JVM running for 80.644)
2018-02-13 07:39:19.933 INFO 13910 --- [pool-1-thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1f7f216f: startup date [Tue Feb 13 07:39:19 CET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1967c7cf
2018-02-13 07:39:19.933 INFO 13910 --- [pool-1-thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1967c7cf: startup date [Tue Feb 13 07:39:19 CET 2018]; root of context hierarchy
2018-02-13 07:39:20.082 INFO 13910 --- [pool-1-thread-1] o.s.c.e.event.RefreshEventListener : Refresh keys changed: [some.value]
As you can see from logs after application started it's automatically registered in consul. When value was changed it's automatically update configuration inside of application.
However in 2.0.0.M7 behaviour is not the same:
https://github.com/olehlesiuk/demo-springboot-2.0.0.M7
added to generated configuration:
@EnableDiscoveryClient
and config file bootstrap.properties with
spring.cloud.consul.discovery.health-check-path=/actuator/health
spring.application.name=s1pconsuldemo
2018-02-13 07:35:28.272 INFO 13788 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-02-13 07:35:28.287 INFO 13788 --- [ main] o.s.c.c.s.ConsulServiceRegistry : Registering service with consul: NewService{id='s1pconsuldemo', name='s1pconsuldemo', tags=[], address='192.168.1.112', port=8080, enableTagOverride=null, check=Check{script='null', interval='10s', ttl='null', http='http://192.168.1.112:8080/actuator/health', tcp='null', timeout='null', deregisterCriticalServiceAfter='null', tlsSkipVerify=null, status='null'}, checks=null}
2018-02-13 07:35:28.326 INFO 13788 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 4.846 seconds (JVM running for 8.42)
2018-02-13 07:35:32.051 INFO 13788 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-02-13 07:35:32.052 INFO 13788 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-02-13 07:35:32.066 INFO 13788 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 14 ms
Application did not react on change in consul (version 1.5.9 did)
only after ‘$ curl -X POST localhost:8080/actuator/refresh’
response: ["some.value"]
value was refreshed in application
2018-02-13 07:41:21.421 INFO 13788 --- [nio-8080-exec-6] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1bfaaea5: startup date [Tue Feb 13 07:41:21 CET 2018]; root of context hierarchy
2018-02-13 07:41:21.450 INFO 13788 --- [nio-8080-exec-6] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-02-13 07:41:21.467 INFO 13788 --- [nio-8080-exec-6] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a41a6a97] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-02-13 07:41:21.491 INFO 13788 --- [nio-8080-exec-6] o.h.v.i.engine.ValidatorFactoryImpl : HV000238: Temporal validation tolerance set to 0.
2018-02-13 07:41:21.565 INFO 13788 --- [nio-8080-exec-6] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='consul', propertySources=[ConsulPropertySource {name='config/s1pconsuldemo/'}]}
2018-02-13 07:41:21.568 INFO 13788 --- [nio-8080-exec-6] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2018-02-13 07:41:21.570 INFO 13788 --- [nio-8080-exec-6] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@9b3b40a: startup date [Tue Feb 13 07:41:21 CET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1bfaaea5
2018-02-13 07:41:21.572 INFO 13788 --- [nio-8080-exec-6] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-02-13 07:41:21.579 INFO 13788 --- [nio-8080-exec-6] o.s.boot.SpringApplication : Started application in 0.188 seconds (JVM running for 361.69)
2018-02-13 07:41:21.579 INFO 13788 --- [nio-8080-exec-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@9b3b40a: startup date [Tue Feb 13 07:41:21 CET 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1bfaaea5
2018-02-13 07:41:21.580 INFO 13788 --- [nio-8080-exec-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1bfaaea5: startup date [Tue Feb 13 07:41:21 CET 2018]; root of context hierarchy
May anyone suggest how to configure springboot 2.0.0.M7 and spring cloud consul 2.0.0.M4 to behave as springboot 1.5.9 and spring cloud consul Edgware.RELEASE