Class DataSourceProxy

  • All Implemented Interfaces:
    java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.DataSource

    public class DataSourceProxy
    extends org.springframework.jdbc.datasource.AbstractDataSource
    This purpose of this class is to fix a class loading issue that occurs in some application servers when using a datasource/pool from the container @ClassLoader. By having this class at the app level, proxying that occurs (e.g. RefreshScope annotation) doesn't encounter problems if another proxying library somewhere else uses the container class loader and encounters other proxying classes in the application.

    Extends AbstractDataSource but it could probably just delegate all methods to the wrapped datasource if anything that AbstractDataSource is doing causes a problem.

    Since:
    5.1
    • Field Summary

      • Fields inherited from class org.springframework.jdbc.datasource.AbstractDataSource

        logger
    • Constructor Summary

      Constructors 
      Constructor Description
      DataSourceProxy()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.sql.Connection getConnection()  
      java.sql.Connection getConnection​(java.lang.String username, java.lang.String password)  
      • Methods inherited from class org.springframework.jdbc.datasource.AbstractDataSource

        getLoginTimeout, getLogWriter, getParentLogger, isWrapperFor, setLoginTimeout, setLogWriter, unwrap
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.sql.CommonDataSource

        createShardingKeyBuilder
      • Methods inherited from interface javax.sql.DataSource

        createConnectionBuilder
    • Constructor Detail

      • DataSourceProxy

        public DataSourceProxy()
    • Method Detail

      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String username,
                                                 java.lang.String password)
                                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException