title: Cannot use Feign client from a message consumer
body: <p>I have a set of three microservices created with JHipster and configured with Okta OAuth2 autentication.</p>
  
  <p>I've also added the integration with RabbitMQ message service so one of the service produce messages on certain events and other one consume those messages to update its database.</p>
  
  <p>Now the second service, to full update its data, needs information from a third service that I would like to call with FeignClient but it fails with the following stack:</p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'request' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:362)
  at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
  at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
  at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:193)
  at com.sun.proxy.$Proxy237.getAccessToken(Unknown Source)
  at it.myefm.myspot.people.security.oauth2.AuthorizationHeaderUtil.getAuthorizationHeaderFromOAuth2Context(AuthorizationHeaderUtil.java:26)
  at it.myefm.myspot.people.client.TokenRelayRequestInterceptor.apply(TokenRelayRequestInterceptor.java:23)
  at feign.SynchronousMethodHandler.targetRequest(SynchronousMethodHandler.java:158)
  at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:88)
  at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76)
  at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108)
  at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302)
  at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298)
  at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46)
  ... 113 more
  
  Caused by: java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
  at org.springframework.web.context.request.RequestContextHolder.currentRequestAttributes(RequestContextHolder.java:131)
  at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:42)
  at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:350)
  ... 126 more
  </code></pre>
  
  <p>I think the problem is that the Feign execution does not start from a web request so there is no authentication infos in context...right?</p>
  
  <p>Is there other way to reach my data between services?</p>