意思说的是你的factory-bean指向同一个bean定义,经过查看发现,我的类名和方法名一样(忽略大小写,因为当不指定名字时,默认是首字母小写作为bean的名字)

//
@Service
public class JedisPool {@AutowiredRedisConfig redisConfig;@Beanpublic redis.clients.jedis.JedisPool jedisPool(){JedisPoolConfig jedisPoolConfig=new JedisPoolConfig();jedisPoolConfig.setMaxIdle(redisConfig.getPoolMaxIdle());jedisPoolConfig.setMaxTotal(redisConfig.getPoolMaxTotal());jedisPoolConfig.setMaxWaitMillis(redisConfig.getPoolMaxWait()*1000 );//database表示库的个数redis.clients.jedis.JedisPool jp=new redis.clients.jedis.JedisPool(jedisPoolConfig,redisConfig.getHost(),redisConfig.getPort(),redisConfig.getTimeout()*1000,redisConfig.getPassword(),0);return jp;}
}

@Service和@Bean重复创建了一个名字叫jedisPool的bean,导致出现上述错误
解决:1、类名或方法名修改;
2、在创建bean时指定bean的名称(@Bean(“xxx”))

修改类名后,运行正常。

// An highlighted block
package com.dec14.redis;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import redis.clients.jedis.JedisPoolConfig;
@Service
public class JedisPoolFactory {@AutowiredRedisConfig redisConfig;@Beanpublic redis.clients.jedis.JedisPool jedisPool(){JedisPoolConfig jedisPoolConfig=new JedisPoolConfig();jedisPoolConfig.setMaxIdle(redisConfig.getPoolMaxIdle());jedisPoolConfig.setMaxTotal(redisConfig.getPoolMaxTotal());jedisPoolConfig.setMaxWaitMillis(redisConfig.getPoolMaxWait()*1000 );//database表示库的个数redis.clients.jedis.JedisPool jp=new redis.clients.jedis.JedisPool(jedisPoolConfig,redisConfig.getHost(),redisConfig.getPort(),redisConfig.getTimeout()*1000,redisConfig.getPassword(),0);return jp;}
}
2020-12-18 15:44:36.552  INFO 19908 --- [           main] com.dec14.Demo01Application              : Starting Demo01Application using Java 12.0.2 on Fafasir with PID 19908 (D:\java-project\miaosha01\target\classes started by Administrator in D:\java-project\miaosha01)
2020-12-18 15:44:36.553  INFO 19908 --- [           main] com.dec14.Demo01Application              : No active profile set, falling back to default profiles: default
2020-12-18 15:44:37.490  INFO 19908 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2020-12-18 15:44:37.501  INFO 19908 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2020-12-18 15:44:37.501  INFO 19908 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.41]
2020-12-18 15:44:37.586  INFO 19908 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2020-12-18 15:44:37.586  INFO 19908 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 988 ms
2020-12-18 15:44:37.867  INFO 19908 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-12-18 15:44:38.006  INFO 19908 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2020-12-18 15:44:38.006  INFO 19908 --- [           main] com.dec14.Demo01Application              : Started Demo01Application in 1.733 seconds (JVM running for 2.401)

为中华之崛起而读书!!!
为了梦想
为了鸣鸣
fighting!!!!!

小白踩坑记:spring初始化时出现:factory-bean reference points back to the same bean definition相关推荐

  1. 小白踩坑记:springboot运行一直报错:There was an unexpected error (type=Not Found, status=404).

    唉,最近在学习springboot集成thymeleaf模板引擎时,明明都配置的好好的,却一直给爷报错,给小爷整懵了:更奇特的是,就挺秃然的就发现似乎哪里有问题了,一经改正,终于拨云见日了... 首先 ...

  2. iOS旧版微信SDK升级1.8.6版本小白踩坑记

    虽然写了多年前端,但是一直都是写的lua,这次突然接到通知要升级微信SDK,以前也不是我捣鼓的,这下可愁坏了.本着万事不明,先备份改错的心态去下了微信SDK然后对比了下,发现跟以前没太大区别.主要区别 ...

  3. linux python3.8源码安装_linux 下从源码安装 Python——小白踩坑记

    实验室服务器使用的系统为 Ubuntu 16.04,自带的 python 版本为 Python 2.7.12 和 Python 3.5.2,命令行下使用$ python命令来启动 python 时默认 ...

  4. 小白踩坑记-Redis的安装与使用

    Redis的安装与使用 文章目录 Redis的安装与使用 1 Window安装redis 1.1 下载redis源码压缩包 1.2 配置环境变量 1.3 开启命令行服务 1.4 将redis服务添加到 ...

  5. Spring @Transactional踩坑记

    @Transactional踩坑记 总述 ​ Spring在1.2引入@Transactional注解, 该注解的引入使得我们可以简单地通过在方法或者类上添加@Transactional注解,实现事务 ...

  6. m3u8 video ios h5_移动端H5页面踩坑记

    移动端H5页面踩坑记 移动端的样式问题 「1. 安卓 font-weight:700;以上才被认为是加粗.」 「2. border 在 1px 以内是不被安卓识别的一些 0.5px 的下划线怎么搞?」 ...

  7. Vue + TypeScript + Element 搭建简洁时尚的博客网站及踩坑记

    前言 本文讲解如何在 Vue 项目中使用 TypeScript 来搭建并开发项目,并在此过程中踩过的坑 . TypeScript 具有类型系统,且是 JavaScript 的超集,TypeScript ...

  8. 口罩、安全帽识别比赛踩坑记(二) 比赛流程及 SSD / YOLO V3 两版本实现

    本篇文章主要对比赛流程中的各个环节进行展开说明,并对笔者践行过的代码及更改的地方进行记录.如哪里有侵权请联系笔者进行删除.另外在这里对比赛举办方表示感谢 ~ ~ 其中开源代码会在整理后放在github ...

  9. Go 语言踩坑记——panic 与 recover

    题记 Go 语言自发布以来,一直以高性能.高并发著称.因为标准库提供了 http 包,即使刚学不久的程序员,也能轻松写出 http 服务程序. 不过,任何事情都有两面性.一门语言,有它值得骄傲的优点, ...

最新文章

  1. Python-EEG工具库MNE中文教程(1)-MNE中数据结构Raw及其用法简介
  2. 自动ssh登录的几种方法
  3. jquery 轮播插件 bxslider
  4. 发布Apworks应用开发框架(Alpha版本)
  5. flink checkpoint 恢复_Flink断点恢复机制
  6. boost::dynamic_bitset模块的测试程序
  7. 机器学习实战学习笔记 一 k-近邻算法
  8. 数据可视化大屏设计经验分享 【进阶篇】
  9. [转载]更改XP默认字体为微软雅黑
  10. mac文件修改权限设置
  11. osm数据下载 python_用Python编写小工具下载OSM路网数据
  12. 简单的Python少儿编程
  13. 读懂才会用 : 瞅瞅Redis的epoll模型
  14. 阿里云短信验证码注册
  15. 使用geronimo-javamail_1.4发送邮件的有关说明
  16. Hadoop报错Permissions incorrectly set for dir /tmp/hadoop-LeiHanhan/nm-local-dir/filecache, should be
  17. CAP迷思:关于分区容忍性
  18. android图片资源加密解密,[原创]cocos2d游戏图片资源解密
  19. 从应用迁移到平台微认证:鲲鹏技术解读
  20. 名编辑电子杂志大师教程 | 添加页码

热门文章

  1. NFS协议介绍(NAS)
  2. JAVA 包和作用域
  3. 2004年中国软件产业最大规模前100家企业名单
  4. 小米12和iQOOneo5s参数对比
  5. 微信小程序多选标签的实现(单选或者多选)
  6. 读沈向阳博士《You are how you read》有感
  7. html上的样式 ui vant_Vant UI的组件使用问题
  8. Java中parseInt用法(double类似)
  9. 概率论知识回顾(十五):变量函数的期望,期望的性质
  10. GoAccess轻量nginx日志分析工具