/** * Create a new DataSourceTransactionManager instance. * @param dataSource the JDBC DataSource to manage transactions for */ public DataSourceTransactionManager(DataSource dataSource) { this(); setDataSource(dataSource); afterPropertiesSet(); }
public ConnectionProperties newConnectionProperties(String theUrl, String theUsername, String thePassword) { Driver driver; try { driver = (Driver) Class.forName(myDriverClassName).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new InternalErrorException("Unable to find driver class: " + myDriverClassName, e); } BasicDataSource dataSource = new BasicDataSource(){ @Override public Connection getConnection() throws SQLException { ourLog.debug("Creating new DB connection"); return super.getConnection(); } }; dataSource.setDriverClassName(myDriverClassName); dataSource.setUrl(theUrl); dataSource.setUsername(theUsername); dataSource.setPassword(thePassword); DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(); transactionManager.setDataSource(dataSource); transactionManager.afterPropertiesSet(); TransactionTemplate txTemplate = new TransactionTemplate(); txTemplate.setTransactionManager(transactionManager); txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); txTemplate.afterPropertiesSet(); return new ConnectionProperties(dataSource, txTemplate, this); }
public void afterPropertiesSet() { super.afterPropertiesSet(); ldapManagerDelegate.checkRenamingStrategy(); } }
/** * Create a new DataSourceTransactionManager instance. * @param dataSource JDBC DataSource to manage transactions for */ public DataSourceTransactionManager(DataSource dataSource) { this(); setDataSource(dataSource); afterPropertiesSet(); }
public void afterPropertiesSet() { super.afterPropertiesSet(); ldapManagerDelegate.checkRenamingStrategy(); } }
public void afterPropertiesSet() { super.afterPropertiesSet(); ldapManagerDelegate.checkRenamingStrategy(); } }
public void afterPropertiesSet() { super.afterPropertiesSet(); ldapManagerDelegate.checkRenamingStrategy(); } }
/** * For each {@link DataSource} add a {@link DataSourceTransactionManager} bean. * * @param dataSource The data source * @return The bean to add */ @EachBean(DataSource.class) DataSourceTransactionManager dataSourceTransactionManager( DataSource dataSource) { DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager(dataSource); dataSourceTransactionManager.afterPropertiesSet(); return dataSourceTransactionManager; }
/** * Create a new DataSourceTransactionManager instance. * @param dataSource the JDBC DataSource to manage transactions for */ public DataSourceTransactionManager(DataSource dataSource) { this(); setDataSource(dataSource); afterPropertiesSet(); }