title: How to resolve environment via url path variable?
body: <p>I have some rest web application with endpoint:
  <code>/some/endpoint</code> in SomeController</p>
  
  <p>I want my application to resolve environment config via path variable. This config should define DB to which should my application connect. </p>
  
  <p>E.g.: <code>/db1/some/endpoint</code> means that application should use <code>db1</code> config. This config will be used to setup context with SCOPE_REQUEST. </p>
  
  <p>How should I do this without changes to SomeController?</p>
  
  <p>UPDATED:
  Sure, I can do it directly in Controller with request mapping like</p>
  
  <pre><code>@RequestMapping(value = "/{config}/my/super/endpoint"})
  public void mySuperEndpoint(@PathVariable("config") String config) {
      myConfig.use(config);
  
      ...
  
  }
  </code></pre>
  
  <p>but what if I have 10 endpoints? or 10 controllers? and all of them need same logic with config.</p>