2016-07-13 4 views
0

Я использую 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 ссылка?

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

+0

Не могли бы вы добавить версию Spring Data Couchbase вы используете? –

+0

Версия 2.1.2 –

ответ

0

Я решил проблему, ниже сниппета мой 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>