Class SpringDataSourceConnectionProvider

java.lang.Object
org.axonframework.extension.spring.jdbc.SpringDataSourceConnectionProvider
All Implemented Interfaces:
ConnectionProvider

public class SpringDataSourceConnectionProvider extends Object implements ConnectionProvider
ConnectionProvider implementation that is aware of Transaction Managers and provides the connection attached to an active transaction manager, instead of asking a Data Source directly.
Since:
2.2
Author:
Allard Buijze
  • Constructor Details

    • SpringDataSourceConnectionProvider

      public SpringDataSourceConnectionProvider(DataSource dataSource)
      Initialize the connection provider, using given dataSource to obtain a connection, when required.
      Parameters:
      dataSource - The data source to obtain connections from, when required
  • Method Details

    • getConnection

      public Connection getConnection() throws SQLException
      Description copied from interface: ConnectionProvider
      Returns a connection, ready for use.

      The caller must never commit, roll back, or close the returned connection directly; its lifecycle is managed externally by whatever this provider obtained it from.

      Specified by:
      getConnection in interface ConnectionProvider
      Returns:
      a connection to use, never null
      Throws:
      SQLException - when an error occurs obtaining the connection