开发者

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

开发者 https://www.devze.com 2022-12-22 01:55 出处:网络
Does it set a flag in a bean ? Does it load \"special\" bean 开发者_开发百科which then looks for @Transactional ?It scans all beans in the application context and creates AOP interceptor for those whi

Does it set a flag in a bean ? Does it load "special" bean 开发者_开发百科which then looks for @Transactional ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消