春季交易:如果我不对方法进行@Transaction注释,会发生什么
2022-09-03 15:35:51
						我正在使用Spring-Boot,Spring Rest Controller和Spring Data JPA。如果我没有指定@Transaction那么也记录get的创建,但我想了解它是如何发生的。我的理解是,Spring默认添加具有默认参数的事务,但不确定它在哪里添加服务层还是在存储库中添加。
 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
   }
 }