I use Spring-Boot, Spring Rest Controller and Spring Data JPA. If I don’t specify @Transaction, then also create a post, but I would like to understand how this happens. You understand that by default, Spring adds a transaction with default parameters, but is not sure where it is added, it adds a service level or to the repository.
public interface CustomerRepository extends CrudRepository<Customer, Long> {
List<Customer> findByLastName(String lastName);
}
@Service
public class CustomerServiceImpl implements CustomerService> {
List<Customer> findByLastName(String lastName){
}
public Customer insert(Customer customer){
}
}
Jdev source
share