0

Does @Transactional work on default methods

This won't work on private methods but not sure about default modifiers

Mahi
  • 1

1 Answers1

0

No, if you by default mean on package-protected. @Transactional will only work with public methods.

Aid Hadzic
  • 578
  • 3
  • 10
  • Whats the reason behind this ? – Mahi Nov 07 '22 at 02:13
  • Because Spring proxy generator by default will simply ignore everything that is not public. Please, refer to this question https://stackoverflow.com/questions/4396284/does-spring-transactional-attribute-work-on-a-private-method, – Aid Hadzic Nov 07 '22 at 07:56