Allahbaksh Asadullah Allahbaksh Asadullah - 1 year ago 102
Java Question

Custom Implementation of Repositories Spring-Data-Cassandra

I am trying to use spring-data-cassandra custom repository implementation. I am using spring-data-cassandra 1.5.M1. The issue is the custom implementation method does not get executed.

Below is the code snippet.

public interface JobRepositoryCustom{
public Job getJobById(String id );

public class JobRepositoryCustomImpl implements JobRepositoryCustom{
CassandraOperations template;

public Job getJobById(String job ) {

System.out.println("Some custom implementation");
return job;

public interface JobRepository extends TypedIdCassandraRepository<Job,String>, JobRepositoryCustom {


The driver program of the same is below

public class App {
public static void main(String[] args) {;
public CommandLineRunner demo( JobRepository repository) {
Job job = new Job();
job.setDescription("My job2 description");
job.setOneMoreField("Just a new field");
job.setTitle("Technical Engineer job");;
//The getJobById is custom method declared in JobRepositoryCustom
repository.getJobById("My String");
System.out.println("This after the job");
System.out.println("repository = [" + repository+ "]");
return null;

Wether I am missing something?

Answer Source

rename JobRepositoryCustomImpl to JobRepositoryImpl:

Here is a example from my code:

public interface ProductRepository extends JpaRepository<Product, Long>, ProductRepositoryCustom {


interface ProductRepositoryCustom {
    public String anyFunction();

class ProductRepositoryImpl implements ProductRepositoryCustom {
    public String anyFunction(){
         return "Hello";
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download