Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does <tx:annotation-driven/> in Spring really do in the code level?

Tags:

spring

Does it set a flag in a bean ? Does it load "special" bean which then looks for @Transactional ?

like image 228
trix Avatar asked Mar 08 '10 15:03

trix


1 Answers

It scans all beans in the application context and creates AOP interceptor for those which are annotated.

This is done via the SpringTransactionAnnotationParser, which is used by TransactionInterceptor - the aformentioned interceptor.

Then whenever these beans are accessed, this advice is triggered and a transaction is started before the target method is executed, and committed after the execution.

like image 181
Bozho Avatar answered Jan 02 '23 01:01

Bozho