title: Combine Dynamic datasource routing with spring-data-rest
body: <p>I'm using Dynamic datasource routing as indicated in this blog post:
  <a href="http://spring.io/blog/2007/01/23/dynamic-datasource-routing/" rel="nofollow">http://spring.io/blog/2007/01/23/dynamic-datasource-routing/</a></p>
  
  <p>This works fine, but when I combine it with <code>spring-data-rest</code> and browsing of my generated repositories I (rightfully) get an exception that my lookup-key is not defined (I do not set a  default).</p>
  
  <p>How and where can I hook into the Spring data rest request handling to set the lookup-key based on 'x' (user authorizations, path prefix, or other), before any connection is made to the database?</p>
  
  <p>Code-wise my datasource configuration just mostly matches the blogpost at the top, with some basic entity classes, generated repositories and Spring Boot to wrap everything together. If need I could post some code, but there's nothing much to see there.</p>