13.5.1Understanding the Spring Framework’s declarative transaction implementation
It is not sufficient to tell you simply to annotate your classes with the@Transactional
annotation, add@EnableTransactionManagement
to your configuration, and then expect you to understand how it all works. This section explains the inner workings of the Spring Framework’s declarative transaction infrastructure in the event of transaction-related issues.
The most important concepts to grasp with regard to the Spring Framework’s declarative transaction support are that this support is enabledvia AOP proxies, and that the transactional advice is driven bymetadata(currently XML- or annotation-based). The combination of AOP with transactional metadata yields an AOP proxy that uses aTransactionInterceptor
in conjunction with an appropriatePlatformTransactionManager
implementation to drive transactionsaround method invocations.
Spring AOP is covered inChapter7,Aspect Oriented Programming with Spring. |
Conceptually, calling a method on a transactional proxy looks like this…