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

20th
Jan 2016
Spencer Gibb
@spencergibb
Jan 20 2016 00:00
yeah, consumer doesn’t care about some details the server cares about.
It should work though, if we say it does. If you have something that recreates the problem, go ahead and submit an issue.
Matt Benson
@mbenson
Jan 20 2016 00:01
will do... tomorrow ;)
Spencer Gibb
@spencergibb
Jan 20 2016 00:01
thx
Matt Benson
@mbenson
Jan 20 2016 00:01
I'm messing around with making it work on my side as well, but I'll be signing off soon. Thank you
Matt Benson
@mbenson
Jan 20 2016 15:00
continuing the above conversation, @spencergibb, it occurs to me that the example in the docs is incomplete and therefore doesn't explicitly spell out what the author expected the body of the @RestController to look like. But what makes the most sense to me is that the user would not be expected to repeat the annotations from the interface; otherwise, what's the point?
Dave Syer
@dsyer
Jan 20 2016 15:03
The point is to use an interface to declare an HTTP interaction
not to share code between client and server (IMO)
Matt Benson
@mbenson
Jan 20 2016 15:03
I agree
it's basically the same thing you'd use an interface for in a single-JVM app
retreading the idea of the old Spring HttpInvoker, only with REST capabilities added for other consumers
Dave Syer
@dsyer
Jan 20 2016 15:05
It's a lot more flexible than that because it doesn't require sharing code between producer and consumer
That's why it's valuable (as REST is)
Matt Benson
@mbenson
Jan 20 2016 15:06
I was just pointing out that there is no point in my submitting a problem report unless we can establish that my expectations are reasonable. The doc doesn't make that crystal clear.
But it sounds like you are on board, anyway, @dsyer
Matt Benson
@mbenson
Jan 20 2016 15:40
related to this, does either of you agree that spring-core's AnnotatedElementUtils should look up the method hierarchy for method parameters as it does with methods themselves? Obviously providing this in Java 1.6-compatible code would not be fun, but it could be done. Or a different workaround could be used until Spring Framework is upgraded to 1.8.
Dave Syer
@dsyer
Jan 20 2016 16:31
Spring Cloud is 1.7
But I think the hierarchy needs to be consulted where possible, so yes, we should be using that if we have the option
Some of the code that detects handler methods is in Spring Web though isn't it?
Matt Benson
@mbenson
Jan 20 2016 16:32
wrt spring-cloud being 1.7: I know, but the place where this seems to be a problem is in spring-webmvc so I thought that, in the long run, anyway, it would make sense for the parameter-walking behavior to be implemented alongside the method-walking behavior, in AnnotatedElementUtils.
I'm testing a workaround over here... is there any particular utility Spring-* code tends to use for creating subclassing proxies? ;)
Dave Syer
@dsyer
Jan 20 2016 16:34
This is an interface isn't it?
So not a subclass
I don't know if that's relevant
Matt Benson
@mbenson
Jan 20 2016 16:36
we are talking about defining the REST API in an interface, and implementing in a class. In my experience, Spring webmvc is failing to find the annotations declared on the interface method parameters. However, my question about subclassing proxies is based elsewhere...
Pedro Vilaça
@pmvilaca
Jan 20 2016 16:36
hey guys.. is there anything already implemented to take advantadge of an architecture that is using zuul as a proxy to every request, to generate a uuid and use that as a marker for the log messages and pass that on a header to the other requests?
Matt Benson
@mbenson
Jan 20 2016 16:36
the idea being that I could replace the RequestMappingHandlerAdapter and override #createInvocableHandlerMethod to find the original interface method.
Dave Syer
@dsyer
Jan 20 2016 16:37
OK. Proxies are generally created with a ProxyFactory I think.
Pedro Vilaça
@pmvilaca
Jan 20 2016 16:37
to also use that value on the underlying requests?
Dave Syer
@dsyer
Jan 20 2016 16:37
@pmvilaca is that not what Spring Cloud Sleuth does?
Matt Benson
@mbenson
Jan 20 2016 16:37
The subclassing proxy comes in because I don't want to repeat all the RMHA config from Spring webmvc/boot
Spencer Gibb
@spencergibb
Jan 20 2016 16:37
:+1: to what @dsyer said. His gitter already had focus.
Matt Benson
@mbenson
Jan 20 2016 16:38
When I looked at ProxyFactory it appeared to be creating jdk proxies, but I'll have another look
Pedro Vilaça
@pmvilaca
Jan 20 2016 16:38
@dsyer I didn't know that ptoject.. I was trying to find something but I wasn’t able to do it, so I decided to ask
thanks for pointing me to the project
Matt Benson
@mbenson
Jan 20 2016 16:40
I see @dsyer wrt ProxyFactory. It does look like it should do what I need.
hmm, I take that back. I'm not seeing how to use this class to create a proxy that allows me to intercept methods and delegate to a target object.
Dave Syer
@dsyer
Jan 20 2016 16:45
MethodInterceptor
Matt Benson
@mbenson
Jan 20 2016 16:46
yeah, I wasn't getting a big enough picture from the source. I'm stepping back to the javadoc so I can see the whole inheritance hierarchy from ProxyConfig on down
Alex Filatov
@sprgn
Jan 20 2016 18:48
Where can I find docs for spring-cloud-cluster?
John G
@jgolubenko
Jan 20 2016 18:56
Hey guys, I'm getting error Could not autowire field: org.springframework.core.env.ConfigurableEnvironment org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration.env; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'environment' is defined
it's coming after Zuul tries to route calls to registered app in eureka (using RibbonRoutingFilter.run(..))
Dave Syer
@dsyer
Jan 20 2016 19:32
Not enough information sorry
Do you have a simple sample project?
John G
@jgolubenko
Jan 20 2016 19:57
I traced down it a little. In my Zuul app main class: I have @Import([FiltersConfiguration.class, someother.class]), then if inside of FiltersConfiguration.class I annotate it with @Configuration and declare @Bean public class AuthFilter authFilter() { return new AuthFilter(); } it fails with 'environment' bean not defined. If I remove @Configuration annotation it works. I hope it makes sense.
I believe it has something to do with over-configuring/complicating things for my own good
Matt Benson
@mbenson
Jan 20 2016 21:00
wrt replacing the RequestMappingHandlerAdapter with a proxy, I ran into the old problem with proxies: it doesn't matter what you reimplement once the target object starts calling its own methods. And seemingly there are not enough property accessors on either RequestMappingHandlerAdapter or RequestMappingHandlerMapping to allow me to replace either bean using a BeanPostProcessor and copy the configuration of the original bean. It appears my only recourse is to replace the entire WebMvcAutoConfiguration but that is a lot of copied code. :(
Dave Syer
@dsyer
Jan 20 2016 21:02
Sounds like you might be trying to solve the wrong problem
It's late here but post some code I a sample project and a README saying what it is trying to do and I'll look to orrow
Matt Benson
@mbenson
Jan 20 2016 21:04
I was about to start working on the sample project, yes
I think we know the "real" fix lies in webmvc, but I was hoping to work around it. Thanks!
Could probably work around in spring-boot as well... just hard for me to do all the way downstream. Sample forthcoming, good night to you