在Spring Boot中找不到Couchbase配置

时间:2018-10-26 10:12:46

标签: spring-boot spring-data-jpa couchbase

我正在尝试创建一个简单的Spring引导应用程序。 当我运行该应用程序时,它无法开始出现此错误:

Caused by: java.io.FileNotFoundException: class path resource [org/springframework/data/couchbase/config/AbstractCouchbaseDataConfiguration.class] cannot be opened because it does not exist

我没有使用Couchbase,仍然显示此错误。 我的pom.xml文件:

<dependencies>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

2 个答案:

答案 0 :(得分:1)

要开始使用Couchbase,您需要添加Spring Boot Starter依赖项:

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-data-couchbase</artifactId>
</dependency>

有关更多详细信息,请参见here

注意:如果您不确定需要哪些依赖项,可以使用Spring Initializr

答案 1 :(得分:0)

在测试阶段,我在一个个人项目中犯了完全相同的错误。 我发现出现此消息是因为错误地我有一个使用SpringBootApplication.class作为基本配置类的测试类,如下所示:

[rbx+const]

似乎开始扫描所有自动配置模块,包括AbstractReactiveCouchbaseDataConfiguration。 刚刚删除了classes属性,错误消失了,测试执行了。