博客
关于我
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实现max non adjacent sum最大非相邻和算法(附完整源码)
    查看>>
    Objective-C实现max subarray sum最大子数组和算法(附完整源码)
    查看>>
    Objective-C实现max sum sliding window最大和滑动窗口算法(附完整源码)
    查看>>
    Objective-C实现MaxHeap最大堆算法(附完整源码)
    查看>>
    Objective-C实现MaximumSubarray最大子阵列(Brute Force蛮力解决方案)算法(附完整源码)
    查看>>
    Objective-C实现MaximumSubarray最大子阵列(动态规划解决方案)算法(附完整源码)
    查看>>
    Objective-C实现maxpooling计算(附完整源码)
    查看>>
    Objective-C实现max_difference_pair最大差异对算法(附完整源码)
    查看>>
    Objective-C实现max_heap最大堆算法(附完整源码)
    查看>>
    Objective-C实现MD5 (附完整源码)
    查看>>
    Objective-C实现md5算法(附完整源码)
    查看>>
    Objective-C实现MeanSquareError均方误差算法 (附完整源码)
    查看>>
    Objective-C实现memcmp函数功能(附完整源码)
    查看>>
    Objective-C实现memoization优化技术算法(附完整源码)
    查看>>
    Objective-C实现memset函数功能(附完整源码)
    查看>>
    Objective-C实现merge insertion sort合并插入排序算法(附完整源码)
    查看>>
    Objective-C实现merge sort归并排序算法(附完整源码)
    查看>>
    Objective-C实现mergesort归并排序算法(附完整源码)
    查看>>
    Objective-C实现miller rabin米勒-拉宾素性检验算法(附完整源码)
    查看>>
    Objective-C实现Miller-Rabin素性测试程序(附完整源码)
    查看>>