I have method like:
private fun exchange(entity: Entity) =
subAccountRepository.save(entity)
This method calls repository:
@Repository
interface SubAccountRepository : R2dbcRepository<SubAccount, Long> {
}
Save responds to public method in Spring:
@NoRepositoryBean
public interface ReactiveCrudRepository<T, ID> extends Repository<T, ID> {
<S extends T> Mono<S> save(S entity);
And the default implementation in Spring is:
@Transactional
public <S extends T> Mono<S> save(S objectToSave) {
Assert.notNull(objectToSave, "Object to save must not be null!");
return this.entity.isNew(objectToSave) ? this.entityOperations.insert(objectToSave) : this.entityOperations.update(objectToSave);
}
Does @Transactional work that way - when called from private method in code ?