I am trying to enable the spring data jpa features and I am getting the following error:
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'fitnessController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Could not autowire field: com.test.fitness.jpa.repo.WeightRepository com.test.fitness.client.FitnessController.weightRe po; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [com.test.fitness.jpa.repo.WeightRepository] is defined: expected single matching bean but found 2: [weightRepository, weightRepositoryImpl]
I have an interface WeightRepository defined in com.test.fitness.jpa.repo as:
and a class which implements the interface in com.diodesign.fitness.jpa.repo.impl:
public interface WeightRepository
extends JpaRepository<Weight, Integer>
List<Weight> findByWeightUser( User weightUser );
I have set to scan for repo data with with the configration:
@Transactional( readOnly = true )
public class WeightRepositoryImpl
... other stubbed methods ...
public List<Weight> findByWeightUser(User weightUser)
return ( this.findByWeightUser( weightUser ) );
<bean name="weightRepository" class="com.diodesign.fitness.jpa.repo.impl.WeightR epositoryImpl">
<jpa:repositories base-package="com.diodesign.fitness.jpa.repo" />
In the controller I have the following:
I tried implementing this based upon the docs and the spring blog http://blog.springsource.com/2011/02...ring-data-jpa/ but I am doing something incorrectly. Does anyone have any suggestions?
public class FitnessController
... methods defined ...