I have method M with @Transactional in service A.
I have service B extends A with overrided method M.
Will be overrided method M still transactional? Or I should add there @Transactional?
I have method M with @Transactional in service A.
I have service B extends A with overrided method M.
Will be overrided method M still transactional? Or I should add there @Transactional?
For Spring @Transactional using proxies (JDK or Cglib) with the default implementation, the method M will inherit the super class annotation attributes and will be transactional.
We can put the annotation on definitions of interfaces, classes, or directly on methods. They override each other according to the priority order; from lowest to highest we have: interface, superclass, class, interface method, superclass method, and class method.[1]
This behavior happens in the SpringTransactionAnnotationParser.[2]
All of the previous imply that the invocations are properly intercepted by Spring. Simply speaking, it needs to be a Spring bean, on a public method, and invoked from another class instance.[3]
[1]Transaction Propagation and Isolation in Spring @Transactional