WIP
- Either extend your interface from
CrudRepository<T, ID>(or more specific variant of it, if the classpath contains repositories for multiple types of data sources sayJpaRepository<T, ID>,MongoRepository<T, ID>) - (or) copy paste selective methods from
CrudRepository/JpaRepositoryinterface and annotate your interface with@RepositoryDefinition(domainClass = T.class, idClass = Id.class). With this your repository interface would be quite clean @EnableJpaRepositories(+ its persistence specific variants) at the@Configurationclass level- Expects the transaction manager to be named
transactionManager& entityManagerFactory to be namedentityManagerFactoryby default. If not, we have to explicitly specify the actual names - For all default method, you can find implementation in
SimpleJpaRepository, which is internally annotated with@Repository(gives exception translation) &@Transactional(readOnly = true)for transactional guarantee