1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
@Bean(name ="jdbcTXManager")
@Primary
public PlatformTransactionManagerdataSourceTransactionManager(DataSource dataSource){
DataSourceTransactionManager dataSourceTransactionManager =new DataSourceTransactionManager();
dataSourceTransactionManager.setDataSource(dataSource);
return dataSourceTransactionManager;
}
@Bean
public JmsTransactionManager jmsTransactionManager(){
JmsTransactionManager jmsTransactionManager =new JmsTransactionManager(activeMQConnectionFactory);
return jmsTransactionManager;
}
使用JMS事务:@Transactional(value ="jmsTransactionManager") 使用数据库事务:@Transactional(value ="jdbcTXManager")
|