类 DataSourceUnwrapper

java.lang.Object
org.springframework.boot.jdbc.DataSourceUnwrapper

public final class DataSourceUnwrapper extends Object
Unwraps a DataSource that may have been proxied or wrapped in a custom Wrapper such as DelegatingDataSource.
从以下版本开始:
2.0.7
作者:
Tadaya Tsuyukubo, Stephane Nicoll
  • 方法详细资料

    • unwrap

      public static <I, T extends I> T unwrap(DataSource dataSource, Class<I> unwrapInterface, Class<T> target)
      Return an object that implements the given target type, unwrapping delegate or proxy if necessary using the specified unwrapInterface.
      类型参数:
      I - the interface that the target type must implement
      T - the target type
      参数:
      dataSource - the datasource to handle
      unwrapInterface - the interface that the target type must implement
      target - the type that the result must implement
      返回:
      an object that implements the target type or null
      从以下版本开始:
      2.3.8
      另请参阅:
    • unwrap

      public static <T> T unwrap(DataSource dataSource, Class<T> target)
      Return an object that implements the given target type, unwrapping delegate or proxy if necessary. Consider using unwrap(DataSource, Class, Class) as unwrapping won't be considered if target is not an interface.
      类型参数:
      T - the target type
      参数:
      dataSource - the datasource to handle
      target - the type that the result must implement
      返回:
      an object that implements the target type or null