Environment:
Java Spring Boot
spring-boot-starter-parent version: 3.2.11
mq-jms-spring-boot-starter version: 3.3.3
Problem Description:
In my main function, I have added the annotation @transactional (org.springframework.transaction.annotation.Transactional).
Inside this main function, I call another service method that is also annotated with @transactional.
When an exception of type org.springframework.dao.DuplicateKeyException is thrown, even though I already have a try-catch block to catch this exception in the main function, the function still keeps retrying automatically.
Question:
Why does the function retry even after the exception has been caught in the main function?
Reference Video:
The following video demonstrates the behavior in my code.
https://github.com/user-attachments/assets/39a68851-aeac-4a72-8725-fb8c89eabc4c