No better way than the TransactionSynchronizationManager.isActualTransactionActive(). It is the utility method used by spring to handle the transactions. Although it is not advisable to use it within your code, for some specific cases you should – that’s why it’s public.
Another way might be to use the entity manager / session / connection and check there if there’s an existing transaction, but I’d prefer the synchronization manager.