title: How to design DAOs when the datasource varies dynamically
body: <p>Usually when defining a DAO, you would have a setter for the datasource on the DAO object.
  My problem is that our datasource varies dynamically based on the request to the server. i.e. every request can access different database instance.</p>
  
  <p>The request holds logical properties, that later can be used to retrieve the connection to the DB of the request.  </p>
  
  <p>So when dependency injecting the DAO to the business logic object, I need a way to set the properties on the DAO at runtime (not configuration time). </p>
  
  <p>One solution is to store the datasource on the thread local, but I don't really like messing with thread local variables. </p>
  
  <p>Another option is to have an initialize method on the business logic object that calls initialize on the DAO with the request properties.</p>
  
  <p>I guess it's a common problem, can you suggest a common solution?</p>