// lookup in context if no transaction template has been configured
LOG.debug("No TransactionTemplate configured on TransactionErrorHandlerBuilder. Will try find it in the registry.");
Map<String, TransactedPolicy> mapPolicy = routeContext.lookupByType(TransactedPolicy.class);
if (mapPolicy != null && mapPolicy.size() == 1) {
TransactedPolicy policy = mapPolicy.values().iterator().next();
if (policy != null && policy instanceof SpringTransactionPolicy) {
transactionTemplate = ((SpringTransactionPolicy) policy).getTransactionTemplate();
}
}
if (transactionTemplate == null) {
TransactedPolicy policy = routeContext.lookup(PROPAGATION_REQUIRED, TransactedPolicy.class);
if (policy != null && policy instanceof SpringTransactionPolicy) {
transactionTemplate = ((SpringTransactionPolicy) policy).getTransactionTemplate();
}
}