博客
关于我
Spring 如何解决循环依赖的问题
阅读量:123 次
发布时间:2019-02-27

本文共 2472 字,大约阅读时间需要 8 分钟。

Spring IOC????????

????????????bean???????????????????Spring?????????????bean????????????????????????????

?????????

????????????bean???????????????????

  • A??B?B??C?C???A?
  • ??????A?B???????????

?????????

  • ?????????

    • ?????????bean?????bean?????bean??????
    • ???
      public class StudentA {    private StudentB studentB;    public StudentA(StudentB studentB) {        this.studentB = studentB;    }}public class StudentB {    private StudentC studentC;    public StudentB(StudentC studentC) {        this.studentC = studentC;    }}public class StudentC {    private StudentA studentA;    public StudentC(StudentA studentA) {        this.studentA = studentA;    }}
    • ??????Spring???????????????
  • setter????????

    • ??bean????field?setter????????bean?????bean??????
    • ???
      public class StudentA {    private StudentB studentB;    public void setStudentB(StudentB studentB) {        this.studentB = studentB;    }}public class StudentB {    private StudentC studentC;    public void setStudentC(StudentC studentC) {        this.studentC = studentC;    }}public class StudentC {    private StudentA studentA;    public void setStudentA(StudentA studentA) {        this.studentA = studentA;    }}
    • ?????????????Spring???????????????
  • ??????????

    Spring???bean????????????????????????????bean????????????????????????bean???????????????????

    ???????????

  • ?????????????

    • Spring??????????????
      • singletonObjects???????????bean?
      • singletonFactories?????bean????
      • earlySingletonObjects??????????bean?
  • ???????

    • ??????????????????
    • ???
    • ?????????????????
  • ?????????

    • ????????????Spring???????????
  • ?????????

    • ?????Spring IDE?BeanFactoryUtils????????
  • ???????

    • ??????????bean???????????????
  • ??Spring??????????

    Spring??????bean??????????????

  • singletonObjects?

    private final Map
    singletonObjects = new ConcurrentHashMap
    (256);
    • ????????????bean?
  • singletonFactories?

    private final Map
    > singletonFactories = new HashMap
    >(16);
    • ??????bean????
  • earlySingletonObjects?

    private final Map
    earlySingletonObjects = new HashMap
    (16);
    • ???????????bean?
  • ???bean??Spring????singletonObjects???bean??????????bean????????earlySingletonObjects????????????????????????singletonFactories????

    ?????????????

  • ?????????

    • ????????????????????????
  • ???????

    • ????bean???????????????
  • ???????

    • ????????????????bean????????
  • ??????????

    • ????????????????????????bean?
  • ????????????????Spring?????????????????????

    转载地址:http://yxmb.baihongyu.com/

    你可能感兴趣的文章
    Python 使用哈希函数用于加密
    查看>>
    Python 依赖管理的革新——Poetry 深度解析
    查看>>
    python 保留精度及增加去除数字的千位分隔符(金额化数字)
    查看>>
    python 倒计时 9,8,7,。。。。。。0
    查看>>
    Python 入门开发学习笔记之数据的增删改查
    查看>>
    Python 入门教程(2)搭建环境 2.4、VSCode配置Node.js运行环境
    查看>>
    Python 八大排序算法合集
    查看>>
    python 关于epoll的学习
    查看>>
    Python 内存管理
    查看>>
    Python 内嵌函数:它们有什么用处?
    查看>>
    Python 判断字符串是否包含子字符串
    查看>>
    python 利用pandas读取本地中CSV文件的指定列 列名重命名 并保存回本地
    查看>>
    python 利用pyspark读取HDFS中CSV文件的指定列 列名重命名 并保存回HDFS
    查看>>
    python 利用pyttsx3文字转语音
    查看>>
    python 利用已有Ner模型进行数据清洗合并
    查看>>
    python 到大数据开发工程师_如何成为一个大数据开发工程师?
    查看>>
    Python 垃圾收集器文档
    查看>>
    python 基于 wordcloud + jieba + matplotlib 生成词云
    查看>>
    Python 基础 - Day 5 Learning Note - 模块 之 标准库:time (1)
    查看>>
    Python 基础语法:None
    查看>>