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
ConstructorDescriptionUnpooledDataSourceProvider
(String driver, String url, ClassLoader driverClassLoader) Creates a new UnpooledDataSource 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
setPassword
(String password) Sets the password.void
Sets 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:
get
in interfacejakarta.inject.Provider<DataSource>
-