0

How can I see the AOP Advice used for @Transactional from Spring framework. I'm using Intellij, and using command Ctrl + click I can go to Transactional interface and here is created the annotation Transactional ant it looks like here:

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Transactional {
    @AliasFor("transactionManager")
    String value() default "";

    @AliasFor("value")
    String transactionManager() default "";

    String[] label() default {};

    Propagation propagation() default Propagation.REQUIRED;

    Isolation isolation() default Isolation.DEFAULT;

    int timeout() default -1;

    String timeoutString() default "";

    boolean readOnly() default false;

    Class<? extends Throwable>[] rollbackFor() default {};

    String[] rollbackForClassName() default {};

    Class<? extends Throwable>[] noRollbackFor() default {};

    String[] noRollbackForClassName() default {};
}

But I want to see the Before Advice because I want to see how is it implemented. Thank you!

elvis
  • 956
  • 9
  • 33
  • 56

1 Answers1

0

Transactional annotation processing is a complex process in Spring, involving many classes. To put it simply, one of the BeanPostProcessor in the postProcessAfterInstantiation method creates an object proxy by wrapping the method in a transaction. But to point to a specific place where this happens is quite problematic, since there are quite a lot of things going on there. If you need more details, then InfrastructureAdvisorAutoProxyCreator class specifically does this. You can look at the class methods in its hierarchy and, for example, set breakpoints and see the entire building process in debug mode

timofeevle
  • 54
  • 3