These are chat archives for spring-cloud/spring-cloud

12th
Sep 2016
Spencer Gibb
@spencergibb
Sep 12 2016 14:24 UTC
@pradeepkusingh if you are routing through the CF lb you’ll only round robbin health check to the instances.
Daco
@dacofr
Sep 12 2016 14:34 UTC
Hi Springboot team,
i've an application connected to a config server
does the keys in src/test/resources/application.properties overwrite the key that are in the config server ?
Stéphane Nicoll
@snicoll
Sep 12 2016 14:36 UTC
using the config server in a test scenario looks very weird to me
Spencer Gibb
@spencergibb
Sep 12 2016 14:36 UTC
yes, it does look odd. config server has highest precedence.
Daco
@dacofr
Sep 12 2016 14:39 UTC
@snicoll how can i desactivate config server durant my tests ?
Spencer Gibb
@spencergibb
Sep 12 2016 14:40 UTC
@dacofr what is the problem?
Daco
@dacofr
Sep 12 2016 14:41 UTC
I've one application with DAO test that are connected to H2.
Now i connect this application to my config server and my tests failed
Spencer Gibb
@spencergibb
Sep 12 2016 14:41 UTC
why is it connected to config server during a test?
Stéphane Nicoll
@snicoll
Sep 12 2016 14:41 UTC
I guess his main spring boot app has @EnableDiscoveryClient
and that’s being used by the tests, right @dacofr ?
Spencer Gibb
@spencergibb
Sep 12 2016 14:42 UTC
that’s eureka/consul not config client btw
Stéphane Nicoll
@snicoll
Sep 12 2016 14:42 UTC
Oh yeah, the other enable thing :)
Daco
@dacofr
Sep 12 2016 14:42 UTC
yes i use @EnableDiscoveryClient
Spencer Gibb
@spencergibb
Sep 12 2016 14:42 UTC
config client is just auto config, not @Enable*.
Stéphane Nicoll
@snicoll
Sep 12 2016 14:43 UTC
confused
Spencer Gibb
@spencergibb
Sep 12 2016 14:43 UTC
you can disable the config client with spring.cloud.config.enabled=false.
Stéphane Nicoll
@snicoll
Sep 12 2016 14:43 UTC
What’s the strategy for not having that to kick in in tests then?
Daco
@dacofr
Sep 12 2016 14:46 UTC
@spencergibb i've put spring.cloud.config.enabled=false in my application.properties in src/test/resources and my test will always "Fetching config from server"
Spencer Gibb
@spencergibb
Sep 12 2016 14:46 UTC
it needs to go in bootstrap.properties.
Daco
@dacofr
Sep 12 2016 14:47 UTC
ok, works now
thanks
ok, so in my src/main/resources i've a bootstrap.properties with spring.application.name, spring.cloud.config.uri
and in src/test/resources a bootstrap.properties with spring.cloud.config.enabled=false
is it the goodway ?
Spencer Gibb
@spencergibb
Sep 12 2016 14:51 UTC
yes
Daco
@dacofr
Sep 12 2016 14:52 UTC
ok, thanks @spencergibb and @snicoll
Daco
@dacofr
Sep 12 2016 15:05 UTC
@spencergibb where can i found a page that indicate in which order are loaded application-*.properties with a config server ?
Daco
@dacofr
Sep 12 2016 15:15 UTC
Thanks
pradeepkusingh
@pradeepkusingh
Sep 12 2016 16:18 UTC
@spencergibb Thank you
David Welch
@dwelch2344
Sep 12 2016 16:54 UTC
Question on SC+Feign: is there a way to wrap / provide a delegate (or just a stub) to override a feign client in a consuming project? We basically want to provide a hard coded instance for local dev / in lower lanes. But if we provide an impl in a @Configuration it doesn't get autowired in
Spencer Gibb
@spencergibb
Sep 12 2016 20:39 UTC
@dwelch2344 not really. Maybe with profiles to spring-cloud never creates the proxy.
maybe a custom feign Target?
David Welch
@dwelch2344
Sep 12 2016 21:10 UTC
Arg yeah it turned out to be tricky
Tried getting in / around the FactoryBean / Registrar, but that got hairy fast
Ended up throwing a PostProcessor in the mix to patch the one class that uses it. Nasty, but does the trick for now
David Welch
@dwelch2344
Sep 12 2016 23:51 UTC
Doesn't SC+Netflix create a Discovery-aware RestTemplate for you automatically?
or is that only with Eureka?
Marcos Barbero
@marcosbarbero
Sep 12 2016 23:54 UTC
I think you can work it out using @LoadBalanced annotation while auto wiring the RestTemplate
David Welch
@dwelch2344
Sep 12 2016 23:56 UTC
hmmm no dice. might be my setup though as we've done that in another service
will have to poke around. wiring in the discoveryclient works so the infrastructure is there :/