Transactions With Spring and Jpafleeting
- External reference: https://www.baeldung.com/transaction-configuration-with-jpa-and-spring
Transactions with Spring and JPA | Baeldung
@EnableTransactionManagement annotation that we can use in a @Configuration class to enable transactional support
@Transactional either at the class or method level:
At a high level, Spring creates proxies for all the classes annotated with @Transactional, either on the class or on any of the methods. The proxy allows the framework to inject transactional logic before and after the running method, mainly for starting and committing the transaction.
see aspect oriented programming with spring.
Any self-invocation calls will not start any transaction, even if the method has the @Transactional annotation.
only public methods should be annotated with @Transactional. Methods of any other visibilities will simply ignore the annotation silently as these are not proxied