Home > Back-end >  The spring transaction
The spring transaction

Time:09-25

In the spring transaction configuration, the configuration file only configure the & lt; Tx: annotation - driven> , and then use the @ Transactional annotation on the method, the transaction will be effective. But in the container and I have no configuration DataSourceTransactionManager, this class is often set the bean id to transactionManager class. Normal configuration are need to configure the DataSourceTransactionManager, I don't have the configuration, the class and there was not a shadow in the configuration file is, but this transaction zhenzhen is rolled back, use mybatis, bosses to explain why?

CodePudding user response:

Configuration transaction manager have five methods, the first is the sort of common configuration, you said the second is the present you this configuration file, which specifies the expression, meet this expression will add transaction management, using annotations can be thought of as a bit more constraints, because the method of transaction prior to the class of transaction, and the third is to use an interceptor, four or five are using a proxy, now you should belong to the second, you see if there are any similar configuration expression="execution (* com. Demo. Spring. Dao. *. * (.. ))"
  • Related