Currently it is, somewhat, hard to set the default transaction timeout in Spring. It requires the configuration of a PlatformTransactionManager and calling the setDefaultTimeout. Now in a regular Spring application this might not be so much of an issue, however when using Spring Boot this might lead to unwanted bean declarations (and auto configuration to back off).

Ofcourse one could utilize a BeanPostProcessor to configure this property after the bean has been created but it would be nice if support was added for this in the framework.

One solution I could think of is extending the @EnableTransactionManagement with a defaultTimeout property and apply this to the configured PlatformTransactionManager.

Comment From: darioseidl

In Spring Boot there is already a property spring.transaction.default-timeout to set the default transaction timeout, is that what you're looking for?

Comment From: snicoll

Currently it is, somewhat, hard to set the default transaction timeout in Spring. It requires the configuration of a PlatformTransactionManager and calling the setDefaultTimeout. Now in a regular Spring application this might not be so much of an issue, however when using Spring Boot this might lead to unwanted bean declarations (and auto configuration to back off).

The argument for the issue means to me it should have been raised to Spring Boot, not here. @darioseidl is right, there is a way to set a timeout via property. More generally, Spring Boot offers a customizer interface you can implement to tune the auto-configured transaction manager without the use of bean post processor.