springboot整合redis报错

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-10-29 11:27:12.945 ERROR 6612 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 0 of method redisTemplate in com.wisezone.springboot.redis.RedisConfig required a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' that could not be found.
- Bean method 'redisConnectionFactory' not loaded because @ConditionalOnClass did not find required class 'org.apache.commons.pool2.impl.GenericObjectPool'

Action:

Consider revisiting the conditions above or defining a bean of type 'org.springframework.data.redis.connection.RedisConnectionFactory' in your configuration.

Process finished with exit code 0

求救啊,整合了一整天都是报这个错,甚至连git别人的项目也还是报这个错,咋整啊各位大佬

2个回答

配置文件配置redis了吗?你的错显示redis找不到不能连接

1,

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
        </dependency>
            这俩依赖是否都引入了?

2,配置文件中是否配置了这几个?

 spring: 
                 redis:
                        host: 127.0.01
                        port: 6379
                        password:
                        database: 6

如果没有配置会调用默认的
源码:

 private static final String DEFAULT_HOST = "localhost";
                        private static final int DEFAULT_PORT = 6379;
                        private String hostName;
                        private int port;
                        private int database;
                        private RedisPassword password;

                        public RedisStandaloneConfiguration() {
                                this.hostName = "localhost";
                                this.port = 6379;
                                this.password = RedisPassword.none();
                        }
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐