小编bum*_*i25的帖子

CRUD 存储库 bean 未找到异常

我有一个连接到 AWS DynamoDB 的应用程序。我正在尝试使用 Jedis 在此应用程序中实现 Redis 连接。

但是,就在我添加此依赖项之后 -

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

我收到这个错误 -

***************************
APPLICATION FAILED TO START
***************************

Description:

Field userInfoRepository in org.csulb.md.service.DBService required a bean of type 'org.csulb.md.repo.UserInfoRepository' that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'org.csulb.md.repo.UserInfoRepository' in your configuration.
Run Code Online (Sandbox Code Playgroud)

UserInfoRepository 实现了 CrudRepository。

我不确定我错过了什么。简而言之,向此代码添加 spring-boot-starter-data-redis 依赖项会出现此错误。如果没有这种依赖性,代码就可以正常工作。

下面是我的其余代码。

主应用程序.java

package org.csulb.md;

@SpringBootApplication
public class MainApp {

    public static void main(String[] args) {
        SpringApplication.run(MainApp.class, …
Run Code Online (Sandbox Code Playgroud)

jedis spring-data spring-data-redis spring-boot aws-java-sdk-dynamodb

5
推荐指数
1
解决办法
2148
查看次数