[英]Redefine methods in repository with spring-data
I'm using spring-data-couchbase 2.1.2
, I want add methods to a single repository. 我正在使用
spring-data-couchbase 2.1.2
,我想将方法添加到单个存储库中。 In implementation class: 在实现类中:
public class MyRepositoryImpl implements MyRepositoryCustom {
@Autowired
RepositoryOperationsMapping templateProvider;
....
}
I added the RepositoryOperationsMapping
but the object is not injected, I have the error below: 我添加了
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
For spring configuration I used the spring.xml
file, how add in xml file the RepositoryOperationsMapping
reference? 对于spring配置,我使用了
spring.xml
文件,如何在xml文件中添加RepositoryOperationsMapping
参考?
Thanks. 谢谢。 Bye.
再见
I solved the issue, below a snippet my spring.xml
file 我在片段
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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.