Currently order of @EnableTransactionManagement is fixed Ordered.LOWEST_PRECEDENCE, It's impossible to provide an @Aspect bean intercepting after transaction started, for example:

@Before("execution(public * *(..)) and @annotation(transactional)")
public void registerTransactionSynchronization(JoinPoint jp, Transactional transactional) {
    if (!transactional.readOnly())
        TransactionSynchronizationManager.registerSynchronization(this); // always failed
}

I hope spring boot could provide option spring.tx.order just like spring.aop.proxy-target-class, It's a bit difficult. The easy way is change order to Ordered.LOWEST_PRECEDENCE+1, but it could break compatibility potentially.

Comment From: wilkinsona

@EnableTransactionManagement doesn't support using an expression for its order attribute as it's typed as an int. This means that there's no way for us to parameterise it. For such a low-level requirement, I think you're better defining the configuration yourself. Spring Boot's EnableTransactionManagementConfiguration is small and should be copied into your own application and modified to meet your needs.