How to restart transactions on deadlock/lock-timeout in Spring?

后端 未结 4 1511
野趣味
野趣味 2020-12-29 04:16

What is the best practice on implementing a transaction restart upon deadlock or lock timeout exceptions when using Spring (specifically the Spring recommended approach: dec

4条回答
  •  庸人自扰
    2020-12-29 05:12

    I recommend using the class org.springframework.retry.interceptor.RetryOperationsInterceptor from the spring retry project, configured like this:

    
        
        
    
    
    
    

    But if you still want to implement it by yourself, the example of AOP from spring documentation is a good start.

提交回复
热议问题