I want to provide transactions in my project. I have ESB with Spring and mySQL. When I send a request to register endpoint, user appears in database and this is good behavior. Then I try to force rollback by throwing RuntimeException and there is no action.
Is it possible to manage the transactions only in Spring?
<tx:annotation-driven transaction-manager="transactionManager" />
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*" propagation="REQUIRED" rollback-for="RuntimeException"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="register" expression="execution(* com.api.Register.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="register" />
</aop:config>
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="url" />
<property name="username" value="username" />
<property name="password" value="password" />
</bean>
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>