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