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 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 form jdbc:subprotocol:subname.
      driverClassLoader - ClassLoader to use to load JDBC driver class.
  • Method Details

    • setUser

      @Inject(optional=true) public void setUser(@Named("JDBC.username") String username)
      Sets the user.
      Parameters:
      username - the new user
      Since:
      3.3
    • setPassword

      @Inject(optional=true) public void setPassword(@Named("JDBC.password") String password)
      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

      public DataSource get()
      Specified by:
      get in interface jakarta.inject.Provider<DataSource>