I have a simple Tomcat application setup to use a MySQL data source with a custom DataSourceFactory. The context.xml is give below. The custom factory is used merely to the placeholders ({{driver}}) with actual values at runtime.
<Context displayName="Foo" path="/foo">
<Resource name="jdbc/MySQLDB"
auth="Container"
type="javax.sql.DataSource"
maxTotal="{{maxTotal}}"
maxIdle="{{maxIdle}}"
...
driverClassName="{{driver}}"
username="{{user}}"
password="{{password}}"
url="{{url}}"
factory="com.example.CustomDataSourceFactory" />
</Context>
The application uses Guice to inject DataSource instances:
bind(DataSource.class).toProvider(fromJndi(DataSource.class, "java:comp/env/jdbc/MySQLDB"));
How can I wrap my MySQL DataSource using a flexy-pool FlexyPoolDataSource?
I checked out the documentation and did the following:
- Added the necessary dependencies (
flexy-pool-core,flexy-java-ee) - Added a
flexy-pool.propertiesfile at resources root (contents below)
flexy.pool.data.source.unique.name=flexy-pool-dataSource
flexy.pool.data.source.jndi.name=jdbc/MySQLDB
flexy.pool.metrics.reporter.jmx.auto.start=true
I'm stuck - how can I make the CustomDataSourceFactory work with flexy-pool?
What should I change and how?