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

23rd
Mar 2017
soorajjoshi
@soorajjoshi
Mar 23 2017 07:38

I am creating event handler class which implement ApplicationListener

Earlier i was using discoveryClient.getDiscoveryServiceUrls(DISCOVERY_CLIENT_ZONE) to achive this. As this is deprecated i am using EndpointUtils.getDiscoveryServiceUrls like below
final List<String> discoveryUrls = EndpointUtils.getDiscoveryServiceUrls(config, DISCOVERY_CLIENT_ZONE,randomizer);

I am trying to get randomizer parameter like below:
private EndpointUtils.ServiceUrlRandomizer randomizer = new EndpointUtils.InstanceInfoBasedUrlRandomizer(applicationInfoManager.getInfo());
I am using @Autowired ApplicationInfoManager applicationInfoManager.

but somehow i am getting null value in applicationInfoManager.

Is there any way to solve this problem?

Dave Syer
@dsyer
Mar 23 2017 07:51
ApplicationInfoManager is "special". You can't autowire it into anything that needs to be initialized early (like an event listener).
You could probably look it up by type in the BeanFactory
Or try and solve your problem another way (one that doesn't depend on Eureka for instance, if you can)
Stevo Slavić
@sslavic
Mar 23 2017 08:53
good morning spring-cloud community
would it make sense to document how to register custom zuul filters as answered on http://stackoverflow.com/a/28468034/381140
Stevo Slavić
@sslavic
Mar 23 2017 08:55
ah, great, missed it "Any beans that you add to the application of type ZuulFilter will be installed automatically"
Dave Syer
@dsyer
Mar 23 2017 08:57
We could always do more documentation.
PR welcome
Stevo Slavić
@sslavic
Mar 23 2017 09:09
to integration test a zuul filter which adds a header to forwarded request for just selected routes I currently make use of spring boot test, spring text mvc, and wiremock - in a way that wiremock mocks downstream services, on a fixed port so that I can configure route to be handled by list of servers via spring boot test context properties
seems wrong to use fixed port, and especially repeating this approach for multiple tests for different filters - was curious is there a better way, to have wiremock start on random port and still be able to configure list of servers with that mock for ribbon route? maybe even without using wiremock?
Dave Syer
@dsyer
Mar 23 2017 09:13
I think it goes through a regular Spring MVC process
But the downstream is an HTTP call I guess.
Stevo Slavić
@sslavic
Mar 23 2017 09:14
register extra configuration source and refresh the context?
yes
Dave Syer
@dsyer
Mar 23 2017 09:15
I think you could maybe use a MockRestServiceServer
Stevo Slavić
@sslavic
Mar 23 2017 09:17
thank you very much, will have a look
Brian
@asmabri
Mar 23 2017 15:15
Using Spring cloud consul, I see a lot of these log messages on startup. Is this a known issue?
level=WARN      class=ConfigurationPropertiesBindingPost
Processor       The @ConfigurationProperties bean class org.springframework.cloud.consul.config.ConsulConfigProperties contains validation constraints but had n
ot been annotated with @Validated.
Spencer Gibb
@spencergibb
Mar 23 2017 15:16
yup