I have created a repository CarRepository that extends JpaRepository<Car, Long>. I also have a test where I declare a member variable of type CarRepository and tag it as @Autowired. The test runs fine.
Now I want to use this repository from another module (not a test). In the class where I will load Car objects I declare a CarRepository variable and also have a setter method for it; my goal is to inject this dependency. In my application-context.xml I define a bean of class CarRepository; everything seems ready to rock. But when I run this code, I get the following exception:
Of course, one of the great things about Spring Data is the ability to define repositories as interfaces and not having to write a single line of code in an implementing class. What is the obvious thing I am missing?Could not instantiate bean class [CarRepository]: Specified class is an interface


Reply With Quote