SPRING4:无法读取候选组件类CouchbaseConfig.class

时间:2015-10-05 05:27:34

标签: java spring-mvc spring-boot spring-data-couchbase

我有问题。我正在使用Spring4,我想添加一个配置,以便能够使用spring数据couchbase,我有一个错误:

  

org.springframework.beans.factory.BeanDefinitionStoreException:无法读取候选组件类:file   [/家庭/查理/桌面/旗舰版   项目/ novare_dashboard / novare项目的仪表板/目标/类/ HK / COM / novare /仪表板/结构/ CouchbaseConfig.class];   嵌套异常是java.lang.annotation.AnnotationFormatError:   默认值无效:public abstract java.lang.Class   org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories.repositoryBaseClass()     在   org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:303)

这是我的代码:

CouchbaseConfig.java

Array ( [10] => 2 [9] => 1 [23] => 1 [7] => 3 [40] => 1 [43] => 1 [5] => 1 ) 

WebMvcConfig.java

<modules>
<Blazedream_Oauth before="Mage_Oauth">Blazedream_Oauth_Customer</Blazedream_Oauth>
</modules>

class Blazedream_Oauth_Customer_AccountController extends Mage_Customer_AccountController
{
// your code
}

的pom.xml

@Configuration
@EnableCouchbaseRepositories
public class CouchbaseConfig extends AbstractCouchbaseConfiguration{

@Override
protected List<String> bootstrapHosts() {
    return Collections.singletonList("localhost");
}

@Override
protected String getBucketName() {
    return "crud";
}

@Override
protected String getBucketPassword() {
    return "password";
}}

2 个答案:

答案 0 :(得分:0)

可以看到缺少repositoryBaseClass配置的错误,这是为CouchbaseConfig类创建存储库代理所需的: -

nested exception is java.lang.annotation.AnnotationFormatError: Invalid default: public abstract java.lang.Class 
org.springframework.data.couchbase.repository.config.EnableCouchbaseRepositories.repositoryBaseClass() at 

请指定与@EnableCouchbaseRepositories

的参数相同

答案 1 :(得分:0)

我刚刚找到了一个关于我的错误的解决方案。您必须将spring-data-couchbase版本更改为1.2.2并将注释@Repository删除到您的存储库。

相关问题