Road SSM learning --spring fourth day _ using annotations to achieve transaction control

Class superscript @Transactional achieve the above matters, and configure the appropriate transaction attribute (represented by the class with the global directly above, each method is the transaction attribute)
if the transaction attribute requirements for different words of a method, in which the method of the above write method @Transactional

First, modify the service implementation class

Here Insert Picture Description

Second, modify the configuration bean.xml

Here Insert Picture Description
This piece of code we do not need, and now give him deleted , because we have achieved through the comments, but at the same time we want to add annotations automatically scans the transaction xml configuration :

transaction-manager cited above is the definition we've transaction manager.

<tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>
Published 23 original articles · won praise 0 · Views 591

Guess you like

Origin blog.csdn.net/SixthMagnitude/article/details/104202629