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

17th
Mar 2015
Johannes Edmeier
@joshiste
Mar 17 2015 13:05
I wonder if the SimpleHostRouting filter should use the 502 (bad gateway) or 504 (gateway timeout) on certain exceptions?
Dave Syer
@dsyer
Mar 17 2015 14:04
Probably
Also the Ribbon filter in that case
checketts
@checketts
Mar 17 2015 16:35
I have some beans annotated with @RefreshScope and another bean trying to inject in that bean, however it fails reporting that no such bean could be found. What is the best way to debug why it can't see the beans in the refresh scope?
Dave Syer
@dsyer
Mar 17 2015 16:37
Look at the beans of type X where X is the type you think it has?
Do you set the proxyMode in @RefreshScope?
checketts
@checketts
Mar 17 2015 16:53
No we didn't set the proxyMode
Dave Syer
@dsyer
Mar 17 2015 17:02
OK. Just that is a possible cause of not finding a bean.
How is it injected? @Autowired?
checketts
@checketts
Mar 17 2015 17:02
@Inject and @Named
Dave Syer
@dsyer
Mar 17 2015 17:03
And what does the error look like?
Did you get the name wrong?
checketts
@checketts
Mar 17 2015 17:04
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.example.MyCacheFactory] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)
This bean is successfully being injected in other SpringBoot services (it is a shared AutoConfig)
This service for some reason is struggling with injecting it.
Dave Syer
@dsyer
Mar 17 2015 17:10
Sounds like an ordering problem. Are you saying it works if the bean is not @RefreshScope?
Does MyCacheFactory depend on anything "fundamental" (like a DataSource)?
I think a sample project might be the only way to get to the bottom of it
checketts
@checketts
Mar 17 2015 17:12
Correct. It was working before adding @RefreshScope in this service (and is still working in other services even with RefreshScope)
It doesn't depend on anything like DataSource
OK, thanks for the help. I'll post any further findings
checketts
@checketts
Mar 17 2015 19:38
Here are some further details as I've debugged into this: there is a DefaultListableBeanFactory with the definition of the missing bean, but Spring is only looking at the parent bean factory.
checketts
@checketts
Mar 17 2015 19:55
Found the issue: It was trying to inject the implementation, but due to cglib the bean was only visible via the interface
RefreshScope's proxy nature exposed the bad code in the project
Dave Syer
@dsyer
Mar 17 2015 20:04
The default proxy mode should be target_class
Was it an unproxyable class?
checketts
@checketts
Mar 17 2015 20:26
It was a normal class, ie MyExampleCache implements ExampleCache
Matt Reynolds
@mattreyuk
Mar 17 2015 20:30
Hi - I'm hoping to get some help setting up multiple clusters for a turbine server. I can define multiple services with turbine.appConfig and show them all with a default cluster but I can't get a cluster per service. I tried turbine.clusterNameExpression=appName