title: Configuring Grails to use own DataSource implementation or to proxy the standard DataSource
body: <p>In an application I want to use my own implementation of <code>javax.sql.DataSource</code> that extends the standard <code>org.apache.commons.dbcp.BasicDataSource</code> used by Grails and adds the functionality to set the client identifier based on the currently logged in user at the Grails application.</p>
  
  <p>What is the best way to change the underlying <code>javax.sql.DataSource</code> implementation in a Grails application?</p>
  
  <p>At the moment I see two possibilities: </p>
  
  <ul>
  <li>change the implementation of the DataSource that is used by Grails</li>
  <li>proxy the DataSource that is used by Grails and add the functionality with AOP</li>
  </ul>
  
  <p>Any hints on how to deal with this requirement?</p>