Closed tvahrst closed 9 months ago
Thanks for the report @tvahrst, I've added the additional condition.
@philwebb when it will be ported to v3.2
? I mean when do you plan to release it?
@vanta today. See https://github.com/spring-projects/spring-boot/milestones and https://calendar.spring.io
HibernateJpaAutoConfiguration
should be applied beforeDatasourceTransactionManagerAutoconfiguration
Explanation:
HibernateJpaAutoConfiguration
importsHibernateJpaBaseConfiguration
which contains a Bean definition of aJPATransactionManager
withConditionalOnMissingBean(TransactionManager)
(in superclass JpaBaseConfiguration):The
DatasourceTransactionManagerAutoConfiguration
does also define aTransactionManager
Bean with the same condition:If the application uses Hibernate, the Hibernate auto-configuration should match, which means that the
HibernateJpaAutoConfiguration
should be applied beforeDatasourceTransactionManagerAutoConfiguration
.Currently, there is no explicit before/after Condition for these Autoconfigurations, but the 'natural' sort order leads 'by chance' to the right order.
We provided for our application a additional auto-configuration with these conditions:
which leaded to a different order of many Spring auto-configuration, especially now sorting
DatasourceTransactionManagerAutoConfiguration
beforeHibernateJpaAutoConfiguration
. As a result, we saw this exception during execution of the application: