NoSuchBeanDefinitionException: No qualifying bean of type ‘redis.clients.jedis.JedisPool’

org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:858) >>> Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'noticeCacheRedis': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'redis.clients.jedis.JedisPool' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:324) ~[spring-context-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1395) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:592) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]

在代码中加入@bean注解

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 你可以参考下这个问题的回答, 看看是否对你有帮助, 链接: https://ask.csdn.net/questions/736600
  • 你也可以参考下这篇文章:NoSuchBeanDefinitionException: No qualifying bean of type ‘org.springframework.data.redis.core.Redis
  • 除此之外, 这篇博客: spring+redis时遇错:No qualifying bean of type 'redis.clients.jedis.JedisCluster' available中的 我的错误简单来说就是:子项目引用另一个子项目的Jedis的xml文件没有被加载到 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

    解决方法:
    修改web.xml,我将关于spring的配置文件都放在了名为spring的文件夹中,如图:
    在这里插入图片描述
    原来:

    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<!--指定文件位置 *通配符 -->
    		<param-value>classpath:spring/*.xml</param-value>
    </context-param>
    

    修改后:

    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<!--指定文件位置 *通配符 -->
    		<param-value>classpath:spring/*.xml,classpath:spring/jedis.xml</param-value>
    </context-param>
    

    或者(推荐使用):

    <context-param>
    		<param-name>contextConfigLocation</param-name>
    		<!--指定文件位置 *通配符 -->
    		<param-value>classpath*:spring/*.xml</param-value>
    </context-param>
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^