I am using Spring-Boot, Spring Rest Controller and Spring Data JPA. If I don't specify @Transaction then also record get's created but I will like to understand how it happens.My understanding is that Spring by default adds a transaction with default parameters but not sure where it adds is it add Service layer or at Repository.
public interface CustomerRepository extends CrudRepository<Customer, Long> {
List<Customer> findByLastName(String lastName);
}
@Service
public class CustomerServiceImpl implements CustomerService> {
List<Customer> findByLastName(String lastName){
//read operation
}
// What will happen if @Transaction is missing. How record get's created without the annotation
public Customer insert(Customer customer){
// insert operations
}
}