When passing the DataSource to the SpringProcessEngineConfiguration (using property “dataSource”), the Camunda engine uses a org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy internally, which wraps the passed DataSource. This is done to make sure the SQL connections retrieved from the DataSource and the Spring transactions play well together. This implies that it’s no longer needed to proxy the dataSource yourself in Spring configuration, although it’s still allowed to pass a TransactionAwareDataSourceProxy into the SpringProcessEngineConfiguration. In this case no additional wrapping will occur.

    Make sure when declaring a in Spring configuration yourself, that you don’t use it for resources that are already aware of Spring-transactions (e.g., DataSourceTransactionManager and JPATransactionManager need the un-proxied dataSource).

    1. ...
    2. <tx:annotation-driven transaction-manager="transactionManager"/>
    3. <property name="runtimeService" ref="runtimeService" />
    4. </beans>

    First, the application context is created with any of the Spring ways to do that. In this example you could use a classpath XML resource to configure our Spring application context:

    or, since it is a test:

    1. @ContextConfiguration("classpath:mytest/SpringTransactionIntegrationTest-context.xml")

    The other way around also works. In this case, the Spring transaction will be around the userBean.hello() method and the engine service method invocation will join that same transaction.

    The UserBean looks like this. Remember from above in the Spring bean configuration we injected the repositoryService into the userBean.