Переопределить методы в репозитории с помощью spring-data

Я использую spring-data-couchbase 2.1.2, я хочу добавить методы в один репозиторий. В классе реализации:

public class MyRepositoryImpl implements MyRepositoryCustom { 

  @Autowired
  RepositoryOperationsMapping templateProvider; 
....
}

Я добавил RepositoryOperationsMapping, но объект не вводится, у меня есть ошибка ниже:

[org.springframework.data.couchbase.repository.config.RepositoryOperationsMapping]: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException

Для весенней конфигурации я использовал файл spring.xml, как добавить в xml файл ссылку RepositoryOperationsMapping?

Спасибо. До свидания.


person Michel Foucault    schedule 13.07.2016    source источник
comment
Не могли бы вы добавить версию Spring Data Couchbase, которую вы используете?   -  person Laurent Doguin    schedule 15.07.2016
comment
Версия 2.1.2   -  person Michel Foucault    schedule 15.07.2016


Ответы (1)


Я решил проблему, ниже фрагмент моего файла spring.xml

<couchbase:clusterInfo login="${cluster.username}" password="${cluster.password}"  id="clusterInfo" />

    <couchbase:bucket bucketName="${bucket.name}" bucketPassword="${bucket.password}" id="bucket"/>

    <!-- template is just using default parameters and references as well -->
     <couchbase:template translation-service-ref="myCustomTranslationService" />
     <bean id="myCustomTranslationService" 
  class="org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService"/>



   <bean id="couchbaseTemplate" class="org.springframework.data.couchbase.core.CouchbaseTemplate">
        <constructor-arg ref="clusterInfo"/>
        <constructor-arg ref="bucket" />
        <constructor-arg ref="myCustomTranslationService" />
   </bean> 

   <bean id="repositoryOperationsMapping" class="org.springframework.data.couchbase.repository.config.RepositoryOperationsMapping"> 
     <constructor-arg ref="couchbaseTemplate"/> 
   </bean>
person Michel Foucault    schedule 15.07.2016