目录

一、报错信息

二、解决:导入依赖不全,检查pom.xml


一、报错信息

Description:

Parameter 1 of method sessionRepositoryFilterRegistration in org.springframework.boot.autoconfigure.session.SessionRepositoryFilterConfiguration required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found.

org.springframework.boot.autoconfigure.session.SessionRepositoryFilterConfiguration中的sessionRepositoryFilterRegistration方法的参数1需要找不到类型为“ org.springframework.data.redis.connection.RedisConnectionFactory”的bean。

使用Spring Boot Redis缓存,项目启动时报错:

The following candidates were found but could not be injected:
    - Bean method 'redisConnectionFactory' in 'JedisConnectionConfiguration' not loaded because @ConditionalOnClass did not find required class 'redis.clients.jedis.Jedis'
    - Bean method 'redisConnectionFactory' in 'LettuceConnectionConfiguration' not loaded because @ConditionalOnClass did not find required class 'io.lettuce.core.RedisClient'

控制台提示:
Action:

Consider revisiting the entries above or defining a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' in your configuration.
Process finished with exit code 1

 

找到了以下候选者,但无法注入:
-未加载'JedisConnectionConfiguration'中的Bean方法'redisConnectionFactory',因为@ConditionalOnClass找不到所需的类'redis.clients.jedis.Jedis'
-未加载“ LettuceConnectionConfiguration”中的Bean方法“ redisConnectionFactory”,因为@ConditionalOnClass找不到所需的类“ io.lettuce.core.RedisClient”
控制台提示:
行动:
考虑在配置中重新访问以上条目或定义类型为“ org.springframework.data.redis.connection.RedisConnectionFactory”的bean。
流程以退出代码1完成

 

二、解决:导入依赖不全,检查pom.xml

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

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

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

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>

        <dependency>
            <groupId>io.lettuce</groupId>
            <artifactId>lettuce-core</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.apachemons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>
    </dependencies>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

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

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

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.47</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>

        <dependency>
            <groupId>io.lettuce</groupId>
            <artifactId>lettuce-core</artifactId>
        </dependency>

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

        <dependency>
            <groupId>org.apachemons</groupId>
            <artifactId>commons-pool2</artifactId>
        </dependency>
    </dependencies>

有用请点赞,养成良好习惯!

疑问、交流、鼓励请留言!

更多推荐

Consider revisiting the entries above or defining a bean of type ‘org.springfram