You are probably not annotating your implementation of the Repository as @Repository. I would recommend however that this functionality be added to the PersonRepository rather than creating a person association repository.
>-----Original Message----- >From: Viknes B [mailto:[email protected]] >Sent: Monday, July 16, 2012 3:49 PM >To: [email protected] >Subject: addFriend - Autowiring problem > >Hello Everybody, > >I am working on creating friends/requests within Rave. Since Opensocial does >not have API to create friends requests I am adding the function addFriend to >DefaultUserService. >I have also added a repository called PersonAssociationRepository within >org.apache.rave.portal.repository to save the friend associations. But when I >try to autowire PersonAssociationRepository in DefaultUserService I am >getting the following error. > >“Caused by: >org.springframework.beans.factory.UnsatisfiedDependencyException: Error >creating bean with name 'defaultNewAccountService' defined in URL >[jar:file:/G:/workspace/Rave/rave-project/rave-components/rave- >core/target/rave-core-0.14- >SNAPSHOT.jar!/org/apache/rave/portal/service/impl/DefaultNewAccountSer >vice.class]: Unsatisfied dependency expressed through constructor argument >with index 0 of type [org.apache.rave.portal.service.UserService]: : Error >creating bean with name 'userService' defined in URL >[jar:file:/G:/workspace/Rave/rave-project/rave-components/rave- >core/target/rave-core-0.14- >SNAPSHOT.jar!/org/apache/rave/portal/service/impl/DefaultUserService.clas >s]: Unsatisfied dependency expressed through constructor argument with >index 7 of type >[org.apache.rave.portal.repository.PersonAssociationRepository]: : No >matching bean of type >[org.apache.rave.portal.repository.PersonAssociationRepository] found for >dependency: expected at least 1 bean which qualifies as autowire candidate >for this dependency. Dependency annotations: {}; nested exception is >org.springframework.beans.factory.NoSuchBeanDefinitionException: No >matching bean of type >[org.apache.rave.portal.repository.PersonAssociationRepository] found for >dependency: expected at least 1 bean which qualifies as autowire candidate >for this dependency. Dependency annotations: {}; nested exception is >org.springframework.beans.factory.UnsatisfiedDependencyException: Error >creating bean with name 'userService' defined in URL >[jar:file:/G:/workspace/Rave/rave-project/rave-components/rave- >core/target/rave-core-0.14- >SNAPSHOT.jar!/org/apache/rave/portal/service/impl/DefaultUserService.clas >s]: Unsatisfied dependency expressed through constructor argument with >index 7 of type >[org.apache.rave.portal.repository.PersonAssociationRepository]: : No >matching bean of type >[org.apache.rave.portal.repository.PersonAssociationRepository] found for >dependency: expected at least 1 bean which qualifies as autowire candidate >for this dependency. Dependency annotations: {}; nested exception is >org.springframework.beans.factory.NoSuchBeanDefinitionException: No >matching bean of type >[org.apache.rave.portal.repository.PersonAssociationRepository] found for >dependency: expected at least 1 bean which qualifies as autowire candidate >for this dependency. Dependency annotations: {}” > >Should I be adding any bean definitions within core-applicationContext.xml or >any other place. >I tried autowiring PersonRepository and it worked. I have created the >PersonAssociationRepository in a similar way but I am not able to autowire it. >Suggestions please. If u need to have a look at my code, I can create a patch >and attach it as well. > >Thanks >Viknes
