Class UnpooledDataSourceProvider
java.lang.Object
org.mybatis.guice.datasource.builtin.UnpooledDataSourceProvider
- All Implemented Interfaces:
jakarta.inject.Provider<DataSource>
public final class UnpooledDataSourceProvider
extends Object
implements jakarta.inject.Provider<DataSource>
Provides the myBatis built-in UnpooledDataSource.
-
Constructor Summary
ConstructorsConstructorDescriptionUnpooledDataSourceProvider(String driver, String url, ClassLoader driverClassLoader) Creates a new UnpooledDataSource 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.voidsetPassword(String password) Sets the password.voidSets the user.
-
Constructor Details
-
UnpooledDataSourceProvider
@Inject public UnpooledDataSourceProvider(@Named("JDBC.driver") String driver, @Named("JDBC.url") String url, @Named("JDBC.driverClassLoader") ClassLoader driverClassLoader) Creates a new UnpooledDataSource 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) -
get
- Specified by:
getin interfacejakarta.inject.Provider<DataSource>
-