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
ConstructorsConstructorDescriptionPooledDataSourceProvider(String driver, String url, ClassLoader driverClassLoader) Creates a new PooledDataSource using the needed parameter. -
Method Summary
Modifier and TypeMethodDescriptionget()voidsetAutoCommit(boolean autoCommit) Sets the auto commit.voidsetDriverProperties(Properties driverProperties) voidsetLoginTimeout(int loginTimeout) Sets the login timeout.voidsetMaximumActiveConnections(int maximumActiveConnections) Sets the maximum active connections.voidsetMaximumCheckoutTime(int maximumCheckoutTime) Sets the maximum checkout time.voidsetMaximumIdleConnections(int maximumIdleConnections) Sets the maximum idle connections.voidsetPassword(String password) Sets the password.voidsetPingConnectionsNotUsedFor(int pingConnectionsNotUsedFor) Sets the ping connections not used for.voidsetPingEnabled(boolean pingEnabled) Sets the ping enabled.voidsetPingEnabled(String pingQuery) Sets the ping enabled.voidsetTimeToWait(int timeToWait) Sets the time to wait.voidSets 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:
getin interfacejakarta.inject.Provider<DataSource>
-