/** Writes audit events to DB asynchronously in a new thread */ @Async public void writeAuditEvent(Object target, EntityAuditAction action) { log.debug("-------------- Post {} audit --------------", action.value()); try { EntityAuditEvent auditedEntity = prepareAuditEntity(target, action); if (auditedEntity != null) { auditingEntityRepository.save(auditedEntity); } } catch (Exception e) { log.error("Exception while persisting audit entity for {} error: {}", target, e); } }