首页 > 解决方案 > 在 Spring Boot 中找不到 Couchbase 配置

问题描述

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

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>

标签: spring-bootspring-data-jpacouchbase

解决方案


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

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

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

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


推荐阅读