I've configured two transaction managers
One in XML Config
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<aop:config>
<aop:advisor pointcut="execution(* com.myorg.*Service.*(..))" advice-ref="transactionAdvice"/>
</aop:config>
<tx:advice id="transactionAdvice" transaction-manager="transactionManager">
</tx:advice>
Other in Java config
@Bean("transactionManager")
public DataSourceTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
But when I use @Transactional annotation it appears to me that Transaction manager defined in XML is being used even when point cut does not match.
I want that on execution that matches pointcut transaction manager defined in AOP to be used and on @Transactional annotation transaction manger defined in Java config to be used.
For some reason I can not explicitly specify transaction manager name in @Transactional annotation like @Transactional("transactionManager").
Is there any way to achieve this ?