I am using spring boot 2.1.2 and have a CustomerRepository which extends CrudRepository, now to override the save method (to do something before save is called) I have created a CustomerInterface and extended CustomerRepository. Now on the CustomerRepository I have @Repository. What should be the annotation for CustomerInterface.
I have tried @Transactional, but is that best in use here ?
@Repository
public interface CustomerRepository extends CrudRepository<Customer, Integer> {
Customer save(Customer customer);
}
public interface PolicyStatusDao extends PolicyIdRepository {
default void extractReport(Customer customer) {
// do something
save(customer);
}
}
Note: Ignore the naming, its just an example. I wanted every class and interface to be annotated with spring (or other annotations like lombok javax etc) wherever required, hence the question.