We ran into an issue with the 2.4.0 release because it replaced DataSourceTransactionManager with JdbcTransactionManager. The latter does exception translation:

  • https://github.com/spring-projects/spring-boot/pull/23572 / https://github.com/spring-projects/spring-boot/commit/9293b2629ecfe5931c41638b2b0db2cfc8aebfe5
  • https://github.com/spring-projects/spring-framework/issues/24064#issuecomment-624619883

This led to a DuplicateKeyException exception being thrown rather than a TransactionSystemException. We didn't expect this because we had explicitly disabled exception translation:

spring.dao.exceptiontranslation.enabled=false

Perhaps DataSourceTransactionManager should continue to be used if this property is set to false?

Comment From: snicoll

Thanks for the report @Gama11. I overlooked that property when I did that change.

Comment From: wilkinsona

Please see https://github.com/spring-projects/spring-boot/issues/24867 for details of a refinement that will be made to the fix for this issue. It should be available in 2.4.3.