title: Guice and VertX injectable request context available throught the application
body: <p>I have been trying to learn ins and outs of VertX Web framework for the past couple of months. 
  I have however came across a problem which I thought would be easily solvable - but to this day I haven't been able to find the solution.</p>
  
  <p>So my problem is:
  I would like to have a web request scoped context to be injectable through out the application.</p>
  
  <p>What I tried doing is something like this:</p>
  
  <pre><code>router.route("...").handler(RoutingContext ctx -&gt; {
      val requestContext = new AppContext(UUID.randomUUID());
      val scope = injector.getInstance(CustomScope.class);
      scope.enter();
      scope.seed(IAppContext.class, requestContext);
  
      ctx.next();
  });
  
  router.route("...").handler(RoutingContext ctx -&gt; {
      // actual code
  
      ctx.next();
  });
  
  router.route("...").handler(RoutingContext ctx -&gt; {
      val scope = injector.getInstance(CustomScope.class);
      scope.exit();
  
      ctx.response().end();
  });
  </code></pre>
  
  <p>I do have a feeling that current solution won't work with multiple requests comming in at the same time. Because VertX runs on a single thread I have to finish the scope before I could enter a new one so this solution is not ok for now.</p>
  
  <p>Guice custom scope is the same as <a href="https://github.com/google/guice/wiki/CustomScopes" rel="noreferrer">this</a> one so if I can fix this in this custom scope code it would be just perfect. I don't know much about these custom scopes so I'm kinda lost on this front...</p>
  
  <p>I would just like to have some request storage somewhere without having to pass it as a parameter to methods all over the application code. I've search around for some way to statically access RoutingContext but no luck for now.</p>