博客
关于我
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/

    你可能感兴趣的文章
    Objective-C实现Fedwick树算法(附完整源码)
    查看>>
    Objective-C实现fenwick tree芬威克树算法(附完整源码)
    查看>>
    Objective-C实现FenwickTree芬威克树算法(附完整源码)
    查看>>
    Objective-C实现fermat little theorem费马小定理算法(附完整源码)
    查看>>
    Objective-C实现FermatPrimalityTest费马素数测试算法(附完整源码)
    查看>>
    Objective-C实现fft2函数功能(附完整源码)
    查看>>
    Objective-C实现FFT快速傅立叶变换算法(附完整源码)
    查看>>
    Objective-C实现FFT算法(附完整源码)
    查看>>
    Objective-C实现fibonacci search斐波那契查找算法(附完整源码)
    查看>>
    Objective-C实现fibonacci斐波那契算法(附完整源码)
    查看>>
    Objective-C实现fibonacci斐波那契算法(附完整源码)
    查看>>
    Objective-C实现FIFO(附完整源码)
    查看>>
    Objective-C实现FigurateNumber垛积数算法(附完整源码)
    查看>>
    Objective-C实现finding bridges寻找桥梁算法(附完整源码)
    查看>>
    Objective-C实现first come first served先到先得算法(附完整源码)
    查看>>
    Objective-C实现fischer yates shuffle洗牌算法(附完整源码)
    查看>>
    Objective-C实现fisherYates洗牌算法(附完整源码)
    查看>>
    Objective-C实现frequency finder频率探测器算法(附完整源码)
    查看>>
    Objective-C实现FTP文件上传(附完整源码)
    查看>>
    Objective-C实现fuzzy operations模糊运算算法(附完整源码)
    查看>>