Class PooledDataSourceProvider
java.lang.Object
org.mybatis.guice.datasource.builtin.PooledDataSourceProvider
- All Implemented Interfaces:
jakarta.inject.Provider<DataSource>
public final class PooledDataSourceProvider
extends Object
implements jakarta.inject.Provider<DataSource>
Provides the myBatis built-in PooledDataSource.
-
Constructor Summary
ConstructorDescriptionPooledDataSourceProvider
(String driver, String url, ClassLoader driverClassLoader) Creates a new PooledDataSource using the needed parameter. -
Method Summary
Modifier and TypeMethodDescriptionget()
void
setAutoCommit
(boolean autoCommit) Sets the auto commit.void
setDriverProperties
(Properties driverProperties) void
setLoginTimeout
(int loginTimeout) Sets the login timeout.void
setMaximumActiveConnections
(int maximumActiveConnections) Sets the maximum active connections.void
setMaximumCheckoutTime
(int maximumCheckoutTime) Sets the maximum checkout time.void
setMaximumIdleConnections
(int maximumIdleConnections) Sets the maximum idle connections.void
setPassword
(String password) Sets the password.void
setPingConnectionsNotUsedFor
(int pingConnectionsNotUsedFor) Sets the ping connections not used for.void
setPingEnabled
(boolean pingEnabled) Sets the ping enabled.void
setPingEnabled
(String pingQuery) Sets the ping enabled.void
setTimeToWait
(int timeToWait) Sets the time to wait.void
Sets the user.
-
Constructor Details
-
PooledDataSourceProvider
@Inject public PooledDataSourceProvider(@Named("JDBC.driver") String driver, @Named("JDBC.url") String url, @Named("JDBC.driverClassLoader") ClassLoader driverClassLoader) Creates a new PooledDataSource using the needed parameter.- Parameters:
driver
- The JDBC driver class.url
- the database URL of the formjdbc:subprotocol:subname
.driverClassLoader
- ClassLoader to use to load JDBC driver class.
-
-
Method Details
-
setUser
Sets the user.- Parameters:
username
- the new user- Since:
- 3.3
-
setPassword
Sets the password.- Parameters:
password
- the new password- Since:
- 3.3
-
setAutoCommit
@Inject(optional=true) public void setAutoCommit(@Named("JDBC.autoCommit") boolean autoCommit) Sets the auto commit.- Parameters:
autoCommit
- the new auto commit
-
setLoginTimeout
@Inject(optional=true) public void setLoginTimeout(@Named("JDBC.loginTimeout") int loginTimeout) Sets the login timeout.- Parameters:
loginTimeout
- the new login timeout
-
setDriverProperties
@Inject(optional=true) public void setDriverProperties(@Named("JDBC.driverProperties") Properties driverProperties) -
setMaximumActiveConnections
@Inject(optional=true) public void setMaximumActiveConnections(@Named("mybatis.pooled.maximumActiveConnections") int maximumActiveConnections) Sets the maximum active connections.- Parameters:
maximumActiveConnections
- the new maximum active connections
-
setMaximumCheckoutTime
@Inject(optional=true) public void setMaximumCheckoutTime(@Named("mybatis.pooled.maximumCheckoutTime") int maximumCheckoutTime) Sets the maximum checkout time.- Parameters:
maximumCheckoutTime
- the new maximum checkout time
-
setMaximumIdleConnections
@Inject(optional=true) public void setMaximumIdleConnections(@Named("mybatis.pooled.maximumIdleConnections") int maximumIdleConnections) Sets the maximum idle connections.- Parameters:
maximumIdleConnections
- the new maximum idle connections
-
setPingConnectionsNotUsedFor
@Inject(optional=true) public void setPingConnectionsNotUsedFor(@Named("mybatis.pooled.pingConnectionsNotUsedFor") int pingConnectionsNotUsedFor) Sets the ping connections not used for.- Parameters:
pingConnectionsNotUsedFor
- the new ping connections not used for
-
setPingEnabled
@Inject(optional=true) public void setPingEnabled(@Named("mybatis.pooled.pingEnabled") boolean pingEnabled) Sets the ping enabled.- Parameters:
pingEnabled
- the new ping enabled
-
setPingEnabled
@Inject(optional=true) public void setPingEnabled(@Named("mybatis.pooled.pingQuery") String pingQuery) Sets the ping enabled.- Parameters:
pingQuery
- the new ping enabled
-
setTimeToWait
@Inject(optional=true) public void setTimeToWait(@Named("mybatis.pooled.timeToWait") int timeToWait) Sets the time to wait.- Parameters:
timeToWait
- the new time to wait
-
get
- Specified by:
get
in interfacejakarta.inject.Provider<DataSource>
-