-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspring-beans-factorybean.drawio
1258 lines (1258 loc) · 195 KB
/
spring-beans-factorybean.drawio
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<mxfile host="Electron" modified="2024-01-22T08:24:25.413Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/21.6.5 Chrome/114.0.5735.243 Electron/25.3.1 Safari/537.36" etag="HDoUD69aVDuY4PPo6hpv" version="21.6.5" type="device">
<diagram name="第 1 页" id="CV3swc8oUeR03U3lH2sZ">
<mxGraphModel dx="3088" dy="879" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="w4FkYv5Shg38tEnAdtc6-482" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;entryPerimeter=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-479" target="w4FkYv5Shg38tEnAdtc6-540" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1830" y="1630" />
<mxPoint x="1830" y="660" />
<mxPoint x="1740" y="660" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-455" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0.1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;entryPerimeter=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-453" target="w4FkYv5Shg38tEnAdtc6-540" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2550" y="2200" />
<mxPoint x="2550" y="660" />
<mxPoint x="1740" y="660" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-2" target="w4FkYv5Shg38tEnAdtc6-5" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-2" value="<font style="font-size: 10px"><b>doGetBean</b>(name, null, null, false)<br><font color="#007fff">这里只分析只传beanName的情况</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="440" y="120" width="159" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-3" value="<font style="font-size: 10px;" color="#000000"><b>AbstractBeanFactory</b></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=9;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="459.5" y="90" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-5" target="w4FkYv5Shg38tEnAdtc6-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-5" value="<span>beanName = transformedBeanName(name)<br><font color="#007fff" style="font-size: 10px;">如果name是"&amp;某工厂Bean名称“, 去掉前面的"&amp;", 如果是别名,从aliasMap获取真实的名字</font><br></span>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="641" y="120" width="199" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-8" target="w4FkYv5Shg38tEnAdtc6-10" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-7" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-8" target="w4FkYv5Shg38tEnAdtc6-14" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-8" value="<font>Object sharedInstance = getSingleton(beanName);<br><font color="#007fff">按beanName尝试先从singleObject获取<br>DEMO此步骤获取的CarFactoryBean这个工厂Bean实例</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="640" y="200" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-216" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-10" target="w4FkYv5Shg38tEnAdtc6-215" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-10" value="<font>return getSingleton(beanName, true);<br><font color="#007fff">true 参数表示正在创建的Bean可以提前暴露</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="880" y="200" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-11" value="<font style="font-size: 10px;">Y</font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-14" target="w4FkYv5Shg38tEnAdtc6-16" edge="1">
<mxGeometry x="-0.1429" relative="1" as="geometry">
<mxPoint x="921" y="819" as="targetPoint" />
<Array as="points">
<mxPoint x="840" y="839" />
<mxPoint x="840" y="750" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-14" target="w4FkYv5Shg38tEnAdtc6-22" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="740.0000000000005" y="1560" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-290" value="<div style="font-size: 10px;"><br></div>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-13" vertex="1" connectable="0">
<mxGeometry x="-0.8859" y="4" relative="1" as="geometry">
<mxPoint x="67" y="20" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-293" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-14" target="w4FkYv5Shg38tEnAdtc6-18" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="840" y="839" />
<mxPoint x="840" y="950" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-294" value="N" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-293" vertex="1" connectable="0">
<mxGeometry x="-0.1399" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-14" value="<font style="font-size: 8px">sharedInstance != null <br>&amp;&amp; args == null<br><font color="#007fff">args指构造方法传参</font><br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="660" y="809" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-237" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-16" target="w4FkYv5Shg38tEnAdtc6-236" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-16" value="<font>bean = <b>getObjectForBeanInstance</b>(<br>sharedInstance, name, beanName, null)<br><font color="#007fff">如果sharedInstance是FactoryBean就调用工厂方法创建Bean并返回,如果不是工厂Bean就直接返回sharedInstance</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="880" y="720" width="201" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-17" value="<font style="font-size: 8px">没有parentBeanFactory&nbsp;|| 当前beanFactory包含此Bean定义<br></font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-18" target="w4FkYv5Shg38tEnAdtc6-65" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="945.0000000000005" y="979" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-18" value="<font style="font-size: 10px;">BeanFactory parentBeanFactory = getParentBeanFactory();<br><font color="#007fff"><span style="">存在父BeanFactory</span><span style="">且当前BeanFactory没有此beanName指定的BeanDefinition, 就交给父BeanFactory创建</span></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="880" y="920" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-297" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-22" target="w4FkYv5Shg38tEnAdtc6-296" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-22" value="<font>return adaptBeanInstance(name, beanInstance, requiredType);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="640" y="1781" width="200" height="59" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-23" value="<font style="font-size: 10px;">下面这块逻辑主要是为了解决循环依赖:<br><br><b style="">singletonObjects</b><span style="">:被称作一级缓存,存储</span><b style="">已经完成初始化</b><span style="">的Bean</span><br><b style="">earlySingletonObjects</b><span style="">:被称作二级缓存,存储</span><b style="">已经实例化但未完成初始化且已经执行过单例工厂方法</b><span style="">的Bean</span><br><b style="">singletonFactories</b><span style="">: 被称作三级缓存,存储</span><b style="">已经实例化但未完成初始化</b><span style="">的Bean的单例工厂</span><br><br><span style=""><b>earlyProxyReferences: </b>保存被代理Bean的原始对象</span><br><br><b style="">singletonsCurrentlyInCreation</b><span style="">: 记录正在创建的Bean</span><br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="1335" y="150" width="545" height="100" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-24" value="Y<br>Bean正在创建" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-26" target="w4FkYv5Shg38tEnAdtc6-28" edge="1">
<mxGeometry y="-10" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-25" value="N<br>两种情况:<br>1 Bean已经创建且初始化完成, 返回完整态Bean<br>2 Bean未创建且未正在创建, 返回null" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-26" target="w4FkYv5Shg38tEnAdtc6-30" edge="1">
<mxGeometry x="-0.7143" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1220" y="380" />
<mxPoint x="1220" y="380" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-26" value="<font style="font-size: 8px">singletonObject == null &amp;&amp; <br>isSingletonCurrentlyInCreation(<br>beanName)</font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="1120" y="280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-27" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-28" target="w4FkYv5Shg38tEnAdtc6-33" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-28" value="<font style="font-size: 9px">singletonObject = this.<b>earlySingletonObjects</b>.get(beanName)<br><font color="#007fff">测试DEMO中此容器并没有使用到,总是为空</font><br></font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=16;" parent="1" vertex="1">
<mxGeometry x="1400" y="280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-30" value="return singletonObject;" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1120" y="620" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-31" value="N<br>两种情况:<br>1 不允许提前暴露,返回null;<br>2&nbsp;singletonObject 不为空,返回未初始化完成的Bean<br>(可能初始化了一部分)。" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-33" target="w4FkYv5Shg38tEnAdtc6-30" edge="1">
<mxGeometry x="-0.5417" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1500" y="560" />
<mxPoint x="1220" y="560" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-32" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-33" target="w4FkYv5Shg38tEnAdtc6-35" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-223" value="Y" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-32" vertex="1" connectable="0">
<mxGeometry x="-0.2333" y="3" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-33" value="<font style="font-size: 8px">singletonObject == null <br>&amp;&amp; allowEarlyReference</font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=16;" parent="1" vertex="1">
<mxGeometry x="1420" y="360" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-525" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-35" target="w4FkYv5Shg38tEnAdtc6-524" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-35" value="<font size="1">ObjectFactory&lt;?&gt; singletonFactory = this.<b>singletonFactories</b>.get(beanName)<br><font color="#007fff">查看这个beanName的单例工厂Bean</font><br></font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=16;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1640" y="360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-36" value="Y" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-38" target="w4FkYv5Shg38tEnAdtc6-527" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-37" value="N, 返回null" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-38" target="w4FkYv5Shg38tEnAdtc6-30" edge="1">
<mxGeometry x="-0.9655" y="-10" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1740" y="580" />
<mxPoint x="1220" y="580" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-38" value="singletonFactory != null" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1680" y="500" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-39" value="返回通过三级别缓存单例工厂获取的bean<br>如果有开启AOP且此Bean类上有增强逻辑则创建并返回代理类" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-40" target="w4FkYv5Shg38tEnAdtc6-30" edge="1">
<mxGeometry x="-0.8519" relative="1" as="geometry">
<mxPoint as="offset" />
<Array as="points">
<mxPoint x="1980" y="600" />
<mxPoint x="1220" y="600" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-523" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="w4FkYv5Shg38tEnAdtc6-40" target="w4FkYv5Shg38tEnAdtc6-28" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-40" value="<div style="font-size: 9px"><span style="background-color: initial;">this.</span><b style="background-color: initial;">earlySingletonObjects</b><span style="background-color: initial;">.put(beanName, singletonObject);</span><br></div><div><font><font size="1">this.<b>singletonFactories</b>.remove(beanName)</font><br><font color="#007fff" style="font-size: 8px">使用三级缓存的早期包装对象创建的纯洁态的bean并存入二级缓存</font><br></font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=16;align=left;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1880" y="500" width="200" height="70" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-45" value="<font style="font-size: 9px;">参考官网:3.5. Spring Type Conversion<br>类型转换的使用案例:https://www.jianshu.com/p/0a484d887b75</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="1085" y="1790.5" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-46" value="<font style="font-size: 10px;">2 上一步结果:<br><b>1)sharedInstance 不为空(Bean实例已经创建或正在创建)<br></b><span style="">1.1)完整态Bean </span><br><span style="">注意:可能是FactoryBean所以需要额外处理;</span><br><span style="">1.2)两种半成品Bean</span><br><b><span style="">2)</span>sharedInstance 为空(Bean实例还未创建)<br></b><span style="">DEMO获取的CarFactoryBean这个工厂Bean实例</span><br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="440" y="783.25" width="220" height="121.5" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-47" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-48" target="w4FkYv5Shg38tEnAdtc6-51" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="960" y="1150" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-48" value="<font>RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);<br><div>dependsOn = mbd.getDependsOn();</div><div><font color="#007fff">查询Bean依赖的Bean</font><br></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="880" y="1101" width="200" height="59" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-49" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-51" target="w4FkYv5Shg38tEnAdtc6-55" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-301" value="<font color="#007fff" style="font-size: 10px;">然后再继续创建当前Bean</font>" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-49" vertex="1" connectable="0">
<mxGeometry x="-0.7349" y="-1" relative="1" as="geometry">
<mxPoint x="-1" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-50" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-51" target="w4FkYv5Shg38tEnAdtc6-57" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-300" value="Y" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-50" vertex="1" connectable="0">
<mxGeometry x="-0.281" y="2" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-51" value="dependsOn <br>!= null ?" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="920" y="1180" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-52" value="<font color="#007fff">单例</font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-55" target="w4FkYv5Shg38tEnAdtc6-60" edge="1">
<mxGeometry x="0.5917" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1081" y="1550" />
<mxPoint x="1081" y="1390" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-53" value="原型" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-55" target="w4FkYv5Shg38tEnAdtc6-61" edge="1">
<mxGeometry x="0.5" y="10" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1060" y="1550" />
<mxPoint x="1060" y="1550" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-54" value="其他(请求、会话)" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-55" target="w4FkYv5Shg38tEnAdtc6-306" edge="1">
<mxGeometry x="0.4137" relative="1" as="geometry">
<Array as="points">
<mxPoint x="1080" y="1550" />
<mxPoint x="1080" y="1711" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-55" value="按Bean作用域创建" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;" parent="1" vertex="1">
<mxGeometry x="920" y="1520" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-57" value="<font>for (String dep : dependsOn):<br><div>registerDependentBean(dep, beanName);</div><div><b>getBean</b>(dep);</div><div><font style="font-size: 9px;" color="#007fff">需要先创建依赖的Bean实例,如果依赖的Bean还依赖其他Bean,就先创建依赖的其他Bean</font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="1180" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-58" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-60" target="w4FkYv5Shg38tEnAdtc6-72" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-59" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;strokeColor=#000000;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-60" target="w4FkYv5Shg38tEnAdtc6-446" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-60" value="<font>sharedInstance = getSingleton(beanName, () -&gt; {...});<br><font style="font-size: 10px;" color="#007fff">先查询一级缓存singletonObjects是否已经存在此Bean,是直接返回,否则通过Lambda表达式(singletonFactory)创建</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="1360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-305" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-61" target="w4FkYv5Shg38tEnAdtc6-76" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1330" y="1550" />
<mxPoint x="1330" y="1670" />
<mxPoint x="1580" y="1670" />
<mxPoint x="1580" y="1469" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-307" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-61" target="w4FkYv5Shg38tEnAdtc6-62" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-61" value="<font>beforePrototypeCreation(beanName);<br>prototypeInstance = <b>createBean</b>(beanName, mbd, args);<br>afterPrototypeCreation(beanName);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="1520" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-308" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-62" target="w4FkYv5Shg38tEnAdtc6-236" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1340" y="1630" />
<mxPoint x="1340" y="880" />
<mxPoint x="1100" y="880" />
<mxPoint x="1100" y="765" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-62" value="<font>beanInstance = <b>getObjectForBeanInstance</b>(<br>prototypeInstance, name, beanName, mbd);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="1599" width="200" height="61" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-63" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-65" target="w4FkYv5Shg38tEnAdtc6-66" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-64" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-65" target="w4FkYv5Shg38tEnAdtc6-48" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-65" value="<font>markBeanAsCreated(beanName)<br><font color="#007fff">记录下beanName防止重复创建</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="880" y="1020" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-66" value="<font><div>synchronized (</div><div>this.mergedBeanDefinitions):&nbsp;<br></div><div>clearMergedBeanDefinition(beanName);</div><div>this.<b>alreadyCreated</b>.add(beanName);</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1120" y="1020" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-67" value="交给父BeanFactory处理和下面流程一样" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="1085" y="939" width="160" height="20" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-304" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.75;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-72" target="w4FkYv5Shg38tEnAdtc6-236" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="1340" y="1470" />
<mxPoint x="1340" y="880" />
<mxPoint x="1100" y="880" />
<mxPoint x="1100" y="765" />
<mxPoint x="1120" y="765" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-72" value="<font><b>getObjectForBeanInstance</b>(sharedInstance, name, beanName, mbd)<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="1440" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-73" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-74" target="w4FkYv5Shg38tEnAdtc6-76" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-449" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-74" target="w4FkYv5Shg38tEnAdtc6-447" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-74" value="<font style="font-size: 9px;"><font style="font-size: 9px;">singletonObject = </font><b style="font-size: 9px;">singletonFactory</b><font style="font-size: 9px;">.</font><b style="font-size: 9px;">getObject</b><font style="font-size: 9px;">();</font><br style="font-size: 9px;"><font style="font-size: 9px;">newSingleton = true;</font><br style="font-size: 9px;"><font color="#007fff" style="font-size: 9px;">singletonFactory是前面的Lambda表达式</font><br style="font-size: 9px;"></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=9;align=left;arcSize=8;" parent="1" vertex="1">
<mxGeometry x="1360" y="1439" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-310" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-76" target="w4FkYv5Shg38tEnAdtc6-431" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1840" y="1390" as="targetPoint" />
<Array as="points">
<mxPoint x="1820" y="1469" />
<mxPoint x="1820" y="1390" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-76" value="<font>return <b>createBean</b>(beanName, mbd, args);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="1600" y="1439" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-189" value="<font color="#007fff" style="font-size: 10px;">先尝试从singletonObjects查,不为空或者正在创建中,直接返回;<br>否则尝试从earlySingletonObjects查,不为空<br>或者为空但是allowEarlyReference 且 singletonFactories包含<br>此beanName的原始对象就通过原始对象创建,<br>并存入earlySingletonObjects</font>" style="text;html=1;align=left;verticalAlign=top;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="860" y="260" width="320" height="90" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-190" value="<h1 style="font-size: 18px"><font style="font-size: 18px">Spring FactoryBean 工作原理(5.3.29)</font></h1><div>Spring IOC完整流程参考 spring-context.drawio 流程,这里从FactoryBean角度看FactoryBean创建Bean的原理。版本虽然不一样,但是差别不大。</div><div>顺便把循环依赖的处理重新梳理下。</div><div>测试DEMO:SpringBoot-Labs/spring-basic/spring-beans/circular-dependency</div><p></p>" style="text;html=1;strokeColor=none;fillColor=none;spacing=5;spacingTop=-20;whiteSpace=wrap;overflow=hidden;rounded=0;" parent="1" vertex="1">
<mxGeometry x="40" y="10" width="760" height="100" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-195" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-191" target="w4FkYv5Shg38tEnAdtc6-194" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-191" value="前置流程参考<br>spring-context.drawio" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">
<mxGeometry x="40" y="120" width="159" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-196" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-194" target="w4FkYv5Shg38tEnAdtc6-2" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-197" value="..." style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-196" vertex="1" connectable="0">
<mxGeometry x="-0.1289" y="-2" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-194" value="<font style=""><font size="1">Object aCar = context<br>.getBean("carFactoryBean");</font><br><font style="font-size: 9px;" color="#007fff">carFacotryBean是CarFactoryBean实例的名字,这里是指通过CarFactoryBean获取Car Bean实例</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="240" y="120" width="159" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-206" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><font style="font-size: 10px;"><font style="font-size: 10px;"><b style="font-size: 10px;">SimpleAliasRegistry </b><font color="#007fff" style="font-size: 10px;">Bean别名CHM容器</font></font><br style="font-size: 10px;"></font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">//CHM别名容器, 为何用CHM?</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, String&gt; <b style="font-size: 10px;">aliasMap</b> = new ConcurrentHashMap(16);</font><br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">//比较重要的方法</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">public void registerAlias(String name, String alias)<br style="font-size: 10px;"></font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">public String canonicalName(String name)</font><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-980" y="140" width="360" height="120" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-210" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-207" target="w4FkYv5Shg38tEnAdtc6-206" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-207" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><font style="font-size: 10px;"><b style="font-size: 10px;">DefaultSingletonBeanRegistry</b> <font style="font-size: 10px;" color="#007fff">单例Bean容器</font><br style="font-size: 10px;"></font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private static final int SUPPRESSED_EXCEPTIONS_LIMIT = 100;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 保存已经完成初始化的单例Bean对象</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Object&gt; <b style="font-size: 10px;">singletonObjects</b> = new <b>ConcurrentHashMap</b>(256);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;" color="#007fff"><font style="font-size: 10px;">//&nbsp;</font>存储已经实例化但未初始化的Bean的单例工厂</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, ObjectFactory&lt;?&gt;&gt; <b style="font-size: 10px;">singletonFactories</b> = new <b>HashMap</b>(16);</font></p><p style="margin: 0px 0px 0px 4px;"><font color="#007fff" style="font-size: 10px;">// 保存</font><font color="#007fff">已经实例化但未初始化且已经执行过单例工厂方法的单例Bean对象</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Object&gt; <b style="font-size: 10px;">earlySingletonObjects</b> = new <b>ConcurrentHashMap</b>(16);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Set&lt;String&gt; <b style="font-size: 10px;">registeredSingletons</b> = new LinkedHashSet(256);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 保存正在创建的Bean对象</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Set&lt;String&gt; <b style="font-size: 10px;">singletonsCurrentlyInCreation</b> = Collections.newSetFromMap(new ConcurrentHashMap(16));</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Set&lt;String&gt; inCreationCheckExclusions = Collections.newSetFromMap(new ConcurrentHashMap(16));</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private Set&lt;Exception&gt; suppressedExceptions;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean singletonsCurrentlyInDestruction = false;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Object&gt; disposableBeans = new LinkedHashMap();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Set&lt;String&gt;&gt; containedBeanMap = new ConcurrentHashMap(16);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 记录Bean依赖的Bean</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Set&lt;String&gt;&gt; dependentBeanMap = new ConcurrentHashMap(64);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">// 记录Bean被依赖的Bean</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Set&lt;String&gt;&gt; dependenciesForBeanMap = new ConcurrentHashMap(64);</font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1080" y="300" width="560" height="260" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-211" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-208" target="w4FkYv5Shg38tEnAdtc6-207" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-208" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><font style="font-size: 10px;"><b style="font-size: 10px;">FactoryBeanRegistrySupport</b><br style="font-size: 10px;"></font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff">//工厂Bean创建的单例对象缓存,注意不是工厂Bean的缓存,比如DEMO中这里缓存的是Car实例(需要设置工厂Bean为单例Bean工厂)</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;">private final Map&lt;String, Object&gt; <b>factoryBeanObjectCache</b> = new ConcurrentHashMap(16);<br style="font-size: 10px;"></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1080" y="599" width="560" height="81" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-212" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-209" target="w4FkYv5Shg38tEnAdtc6-208" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-209" value="<p style="margin: 4px 0px 0px; text-align: center; font-size: 10px;"><font style="font-size: 10px;"><span style="font-size: 10px;"><b>AbstractBeanFactory </b><font style="" color="#007fff">所有BeanFactory实例都继承此类</font></span><br style="font-size: 10px;"></font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private BeanFactory parentBeanFactory;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ClassLoader beanClassLoader = ClassUtils.getDefaultClassLoader();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ClassLoader tempClassLoader;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private boolean cacheBeanMetadata = true;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private BeanExpressionResolver beanExpressionResolver;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ConversionService conversionService;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Set&lt;PropertyEditorRegistrar&gt; propertyEditorRegistrars = new LinkedHashSet(4);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;Class&lt;?&gt;, Class&lt;? extends PropertyEditor&gt;&gt; customEditors = new HashMap(4);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private TypeConverter typeConverter;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final List&lt;StringValueResolver&gt; embeddedValueResolvers = new CopyOnWriteArrayList();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final List&lt;BeanPostProcessor&gt; beanPostProcessors = new BeanPostProcessorCacheAwareList();</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private BeanPostProcessorCache beanPostProcessorCache;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, Scope&gt; scopes = new LinkedHashMap(8);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private SecurityContextProvider securityContextProvider;</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Map&lt;String, RootBeanDefinition&gt; mergedBeanDefinitions = new ConcurrentHashMap(256);</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font color="#007fff" style="font-size: 10px;">//已经创建的Bean的名字集合,为了防止并发重复创建Bean, 这里的Bean不一定已经创建完成,但是有创建的动作</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final Set&lt;String&gt; <b>alreadyCreated</b> = Collections.newSetFromMap(new ConcurrentHashMap(256));</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private final ThreadLocal&lt;Object&gt; prototypesCurrentlyInCreation = new NamedThreadLocal("Prototype beans currently in creation");</font></p><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><font style="font-size: 10px;">private ApplicationStartup applicationStartup;</font></p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1080" y="719.5" width="560" height="280" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-213" value="<font style="font-size: 10px;"><b>DefaultSingletonBeanRegistry</b></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="895" y="170" width="170" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-217" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-215" target="w4FkYv5Shg38tEnAdtc6-26" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-215" value="<font>Object singletonObject = this.<b>singletonObjects</b>.get(beanName)<br><font color="#007fff">DEMO此步骤获取carFacotryBean工厂Bean</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1120" y="200" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-221" value="说明:<br style="font-size: 10px;"><ul style="font-size: 10px;"><li style="font-size: 10px;">工厂Bean也是Bean, 也拥有和普通Bean一样的生命周期,Bean实例也会被保存到各个List、Map容器</li></ul>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="880" y="10" width="560" height="120" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-224" value="<font color="#007fff" style="font-size: 10px;">CarFactoryBean实例在应用上下文初始化阶段被创建</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="240" y="180" width="260" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-244" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-226" target="w4FkYv5Shg38tEnAdtc6-243" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-245" value="Y" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-244" vertex="1" connectable="0">
<mxGeometry x="-0.2375" y="-3" relative="1" as="geometry">
<mxPoint x="9" y="-3" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-248" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-226" target="w4FkYv5Shg38tEnAdtc6-247" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-249" value="N" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-248" vertex="1" connectable="0">
<mxGeometry x="-0.225" y="3" relative="1" as="geometry">
<mxPoint x="-3" y="5" as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-226" value="<font style="font-size: 9px;">BeanFactoryUtils<br>.isFactoryDereference(name)<br><font color="#007fff">即判断name是否是工厂Bean<br>的名称</font><br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1400" y="799" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-229" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-228" target="w4FkYv5Shg38tEnAdtc6-209" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-228" value="<div style="text-align: center;"><b>AbstractAutowireCapableBeanFactory</b></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;">private InstantiationStrategy instantiationStrategy;</p><p style="margin: 0px 0px 0px 4px;">private ParameterNameDiscoverer parameterNameDiscoverer;</p><p style="margin: 0px 0px 0px 4px;">private boolean allowCircularReferences;</p><p style="margin: 0px 0px 0px 4px;">private boolean allowRawInjectionDespiteWrapping;</p><p style="margin: 0px 0px 0px 4px;">private final Set&lt;Class&lt;?&gt;&gt; ignoredDependencyTypes;</p><p style="margin: 0px 0px 0px 4px;">private final Set&lt;Class&lt;?&gt;&gt; ignoredDependencyInterfaces;</p><p style="margin: 0px 0px 0px 4px;">private final NamedThreadLocal&lt;String&gt; <b>currentlyCreatedBean</b>;</p><p style="margin: 0px 0px 0px 4px;">private final ConcurrentMap&lt;String, BeanWrapper&gt; factoryBeanInstanceCache;</p><p style="margin: 0px 0px 0px 4px;">private final ConcurrentMap&lt;Class&lt;?&gt;, Method[]&gt; factoryMethodCandidateCache;</p><p style="margin: 0px 0px 0px 4px;">private final ConcurrentMap&lt;Class&lt;?&gt;, PropertyDescriptor[]&gt; filteredPropertyDescriptorsCache;</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-1080" y="1041" width="560" height="180" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-230" value="<div style="text-align: center;"><b>AbstractApplicationContext</b><br></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;">private String id = ObjectUtils.identityToString(this);</p><p style="margin: 0px 0px 0px 4px;">private String displayName = ObjectUtils.identityToString(this);</p><p style="margin: 0px 0px 0px 4px;">private ApplicationContext parent;</p><p style="margin: 0px 0px 0px 4px;">private ConfigurableEnvironment environment;</p><p style="margin: 0px 0px 0px 4px;">private final List&lt;BeanFactoryPostProcessor&gt; beanFactoryPostProcessors = new ArrayList&lt;&gt;();</p><p style="margin: 0px 0px 0px 4px;">private long startupDate;</p><p style="margin: 0px 0px 0px 4px;">private final AtomicBoolean active = new AtomicBoolean();</p><p style="margin: 0px 0px 0px 4px;">private final AtomicBoolean closed = new AtomicBoolean();</p><p style="margin: 0px 0px 0px 4px;">private final Object startupShutdownMonitor = new Object();</p><p style="margin: 0px 0px 0px 4px;">private Thread shutdownHook;</p><p style="margin: 0px 0px 0px 4px;">private ResourcePatternResolver resourcePatternResolver;</p><p style="margin: 0px 0px 0px 4px;">private LifecycleProcessor lifecycleProcessor;</p><p style="margin: 0px 0px 0px 4px;">private MessageSource messageSource;</p><p style="margin: 0px 0px 0px 4px;">private ApplicationEventMulticaster applicationEventMulticaster;</p><p style="margin: 0px 0px 0px 4px;">private final Set&lt;ApplicationListener&lt;?&gt;&gt; applicationListeners = new LinkedHashSet&lt;&gt;();</p><p style="margin: 0px 0px 0px 4px;">private Set&lt;ApplicationListener&lt;?&gt;&gt; earlyApplicationListeners;</p><p style="margin: 0px 0px 0px 4px;">private Set&lt;ApplicationEvent&gt; earlyApplicationEvents;</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-480" y="660" width="440" height="240" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-233" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-231" target="w4FkYv5Shg38tEnAdtc6-230" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-231" value="<div style="text-align: center;"><b>GenericApplicationContext</b><br></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;">private final <b>DefaultListableBeanFactory</b> <b>beanFactory</b>;</p><p style="margin: 0px 0px 0px 4px;">private ResourceLoader resourceLoader;</p><p style="margin: 0px 0px 0px 4px;">private boolean customClassLoader;</p><p style="margin: 0px 0px 0px 4px;">private final AtomicBoolean refreshed;</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-480" y="941" width="440" height="100" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-234" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;endArrow=block;endFill=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-232" target="w4FkYv5Shg38tEnAdtc6-231" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-232" value="<div style="text-align: center;"><b>AnnotationConfigApplicationContext</b><br></div><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px;">private final AnnotatedBeanDefinitionReader reader;</p><p style="margin: 0px 0px 0px 4px;">private final ClassPathBeanDefinitionScanner scanner;</p><hr style="font-size: 10px;"><p style="margin: 0px 0px 0px 4px; font-size: 10px;"><br style="font-size: 10px;"></p>" style="verticalAlign=top;align=left;overflow=fill;fontSize=10;fontFamily=Helvetica;html=1;whiteSpace=wrap;" parent="1" vertex="1">
<mxGeometry x="-480" y="1081" width="440" height="80" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-235" value="AbstractAutowireCapableBeanFactory" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1105" y="690" width="230" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-240" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-236" target="w4FkYv5Shg38tEnAdtc6-239" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-236" value="<div>String currentlyCreatedBean = (String)this.<b>currentlyCreatedBean</b>.get();</div><div>if (currentlyCreatedBean != null)</div><div>&nbsp; &nbsp; this.<b>registerDependentBean</b>(beanName, currentlyCreatedBean);</div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1120" y="719.5" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-241" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-239" target="w4FkYv5Shg38tEnAdtc6-226" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-239" value="return super.getObjectForBeanInstance(<br>beanInstance, name, beanName, mbd);" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1120" y="799" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-243" value="主要就是在 mbd 中记录此 BeanDefinition 是工厂Bean的定义,然后立即返回" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1640" y="799" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-246" value="普通Bean(非FactoryBean)<br>立即返回" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="1640" y="899" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-250" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-247" target="w4FkYv5Shg38tEnAdtc6-246" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-251" value="Y" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-250" vertex="1" connectable="0">
<mxGeometry x="-0.0292" y="-1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-253" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-247" target="w4FkYv5Shg38tEnAdtc6-252" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-254" value="N" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-253" vertex="1" connectable="0">
<mxGeometry x="-0.122" y="1" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-247" value="<font style=""><font size="1">!(beanInstance instanceof FactoryBean)</font><br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1400" y="899" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-258" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-252" target="w4FkYv5Shg38tEnAdtc6-257" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-252" value="最后一种情况就是通过FactoryBean实例创建<br>目标类型Bean实例<br><font color="#007fff">DEMO中是通过CarFactoryBean实例创建Car Bean实例</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1380" y="1000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-255" value="返回工厂Bean实例" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="1535" y="829" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-256" value="返回普通Bean实例" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="1535" y="932" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-262" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-257" target="w4FkYv5Shg38tEnAdtc6-261" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-264" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-257" target="w4FkYv5Shg38tEnAdtc6-265" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1740" y="1080" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-257" value="<div style=""><font size="1">object = this.getCachedObjectForFactoryBean(</font></div><div style=""><font size="1">beanName);</font><br></div><div style=""><font color="#007fff" size="1">还是优先从factoryBeanObjectCache中查找<b>单例Bean</b></font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1640" y="1000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-260" value="AbstractBeanFactory" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1410" y="769" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-261" value="<div style=""><font size="1">return this.<b>factoryBeanObjectCache</b></font></div><div style=""><font size="1">.get(beanName);</font><br></div><div style=""><font color="#007fff" size="1">注意这个缓存中存的是FactoryBean创建的单例Bean对象</font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1880" y="1000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-269" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-265" target="w4FkYv5Shg38tEnAdtc6-268" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-265" value="<font style="font-size: 8px;"><font size="1">object == null<br></font><font style="font-size: 8px;" color="#007fff">还没用FactoryBean创建单例Bean ||&nbsp;FactoryBean实例不是单例工厂<br>都会导致从上面缓存中获取为空</font><br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1660" y="1080" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-271" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-268" target="w4FkYv5Shg38tEnAdtc6-270" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-268" value="<div style=""><font size="1">FactoryBean&lt;?&gt; factory = (FactoryBean)beanInstance;</font><br></div><div style=""><font size="1">mbd = this.getMergedLocalBeanDefinition(</font></div><div style=""><font size="1">beanName);<br></font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="1880" y="1080" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-273" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-270" target="w4FkYv5Shg38tEnAdtc6-274" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="2120" y="1190" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-270" value="<div style=""><div>boolean synthetic = (mbd != null &amp;&amp; mbd.isSynthetic());</div><div>object = <b>getObjectFromFactoryBean</b>(<br>factory, beanName, !synthetic);</div></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1880" y="1160" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-276" value="Y" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-274" target="w4FkYv5Shg38tEnAdtc6-275" edge="1">
<mxGeometry x="-0.7895" relative="1" as="geometry">
<Array as="points">
<mxPoint x="2220" y="1030" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-280" value="N" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-274" target="w4FkYv5Shg38tEnAdtc6-279" edge="1">
<mxGeometry x="-0.8519" relative="1" as="geometry">
<Array as="points">
<mxPoint x="2220" y="1270" />
</Array>
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-274" value="<font style="font-size: 8px;"><font style="font-size: 8px;">factory.isSingleton() &amp;&amp; <br>containsSingleton(beanName)</font><br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2140" y="1080" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-289" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-275" target="w4FkYv5Shg38tEnAdtc6-287" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-275" value="<div style="font-size: 9px;"><div style="font-size: 9px;">synchronized (getSingletonMutex()) {<font style="font-size: 9px;" color="#007fff"> //获取的是&nbsp;singletonObjects</font></div><div style="font-size: 9px;">&nbsp; &nbsp; Object object = this.<b>factoryBeanObjectCache</b>.get(beanName);</div><div style="font-size: 9px;">&nbsp; &nbsp; if (object == null) {</div><div style="font-size: 9px;"><font style="font-size: 9px;" color="#007fff"><span style=""><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span>//内部主要是调用FactoryBean实例的getObject()方法创建Bean</font><br></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; object = <b>doGetObjectFromFactoryBean</b>(factory, beanName);</div><div style=""><span style="font-size: 9px;"><span style="white-space: pre;">&nbsp;&nbsp;&nbsp;&nbsp; </span></span><font style="font-size: 9px;" color="#007fff">//这里为何又查一遍?</font><span style="background-color: initial;">&nbsp; &nbsp; &nbsp; &nbsp; <br><span style="white-space: pre;">	</span>Object alreadyThere = this.</span><b style="background-color: initial;">factoryBeanObjectCache</b><span style="background-color: initial;">.get(beanName);</span></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; if (alreadyThere != null) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object = alreadyThere;</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; } else {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (shouldPostProcess) { <font color="#007fff">//后置处理</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (isSingletonCurrentlyInCreation(beanName)) {</div><div style="font-size: 9px;"><font color="#007fff">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // Temporarily return non-post-processed object, not storing it yet..</font></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return object;</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>beforeSingletonCreation</b>(beanName);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try {</div><div style="font-size: 9px;"><font color="#007fff"><span style="white-space: pre;">	</span><span style="white-space: pre;">	</span>&nbsp; &nbsp; //就是调用后置处理器,比如执行一些初始化等操作</font><br></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object = <b>postProcessObjectFromFactoryBean</b>(object, beanName);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; catch (Throwable ex) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw new BeanCreationException(...<span style="background-color: initial;">);</span></div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <b>afterSingletonCreation</b>(beanName);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (containsSingleton(beanName)) {</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.<b>factoryBeanObjectCache</b>.put(beanName, object);</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; }</div><div style="font-size: 9px;">&nbsp; &nbsp; return object;</div><div style="font-size: 9px;">}</div></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=2;align=left;" parent="1" vertex="1">
<mxGeometry x="2360" y="840" width="320" height="380" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-278" value="<div style="font-size: 8px;"><font style="font-size: 8px;">是<b>单例</b>工厂Bean &amp;&amp;&nbsp;</font></div><div style="font-size: 8px;"><font style="font-size: 8px;">此工厂Bean<b>已经初始化</b></font></div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="2220" y="1035" width="110" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-286" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-279" target="w4FkYv5Shg38tEnAdtc6-285" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-288" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-279" target="w4FkYv5Shg38tEnAdtc6-287" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-279" value="<div style=""><font size="1">Object object = <b>doGetObjectFromFactoryBean</b>(factory, beanName);</font><br></div><div style=""><font color="#007fff" size="1">传beanName只是为了检查防止其他线程正在创建同名的Bean</font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2360" y="1240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-283" value="<font color="#007fff" style="">Object alreadyThere = this.factoryBeanObjectCache.get(beanName);<br><b style="font-size: 10px;">关于这里为何又查询一遍的思考</b><br style="font-size: 10px;">factoryBeanObjectCache 是私有成员,没有Getter方法(不会在其他类中对factoryBeanObjectCache进行增删改操作<span style="font-size: 10px;">),本类中唯一的put() 操作也是在</span><br style="font-size: 10px;"><span style="font-size: 10px;">synchronized(singletonObjects) 同步控制下执行的;</span><br style="font-size: 10px;"><span style="font-size: 10px;">不太可能因为其他线程的操作导致 alreadyThere != null;&nbsp;<br></span>这里还有什么其他原因么?<br style="font-size: 10px;"></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="2690" y="840" width="390" height="100" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-284" value="<div style="font-size: 8px;">即非单例工厂Bean</div>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="2230" y="1167.5" width="90" height="20" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-285" value="<div style="font-size: 9px;"><font style="font-size: 9px;">if (shouldPostProcess)<br></font></div><div style="font-size: 9px;"><font style="font-size: 9px;">object = <b>postProcessObjectFromFactoryBean</b>(</font></div><div style="font-size: 9px;"><font style="font-size: 9px;">object, beanName);<br></font></div><div style="font-size: 9px;"><font style="font-size: 9px;" color="#007fff">后置处理,</font></div><font style="font-size: 9px;" color="#007fff">就是调用后置处理器,比如执行一些初始化等操作</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2360" y="1320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-287" value="<div style=""><font size="1">object = factory.getObject();</font><br></div><div style=""><font color="#007fff" size="1">通过工厂Bean创建目标Bean</font></div><div style=""><font color="#007fff" size="1">这里省略了系统安全管理器忽略权限限制的代码</font></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2720" y="1240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-291" value="<div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">sharedInstance不为空</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">不为空情况下有两种可能:</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">1. sharedInstance就是需要Bean</font></div><div style="font-size: 10px;"><font style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">2. sharedInstance是创建需要的Bean</font><span style="color: rgb(0, 127, 255); background-color: initial;">的FactoryBean</span></font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="860" y="779.5" width="250" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-295" value="<div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">sharedInstance为空</font></div><div style="font-size: 10px;"><font color="#007fff" style="font-size: 10px;">即之前没有创建Bean</font></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="860" y="880" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-296" value="<font>if (requiredType != null &amp;&amp; !requiredType.isInstance(bean))<br>Object convertedBean = getTypeConverter()<br>.convertIfNecessary(bean, requiredType);<br><font style="font-size: 9px;" color="#007fff">如果要求的返回类型不为空就转换下Bean的类型</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="881" y="1781" width="200" height="59" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-298" value="<font style="font-size: 10px;">3 按要求的返回类型 requiredType <br>对 Bean实例进行类型转换<br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="440" y="1780" width="180" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-299" value="<font style=""><font style="font-size: 10px;">1 先尝试从singletonObjects查,因为要获取的Bean可能已经创建或正在被创建</font><br></font>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=8;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="440" y="200" width="180" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-303" value="<font color="#007fff" style="font-size: 9px;">beforeSingletonCreation afterSingletonCreation <br>是记录下创建状态,用于防止重复Bean重复创建</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1360" y="1315" width="220" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-306" value="<font>暂略<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;" parent="1" vertex="1">
<mxGeometry x="1120" y="1680" width="200" height="61" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-314" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" source="w4FkYv5Shg38tEnAdtc6-313" target="w4FkYv5Shg38tEnAdtc6-16" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-313" value="<div><b><font color="#007fff">FactoryBean 创建 Bean实例</font></b></div><div><b><font color="#007fff">原理主要就是这块</font></b></div>" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">
<mxGeometry x="900" y="650" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-316" value="<font color="#007fff" style="font-size: 9px;">即Bean正在创建<br>且允许提前暴露<br></font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1545" y="400" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-318" value="<font color="#ea6b66">TODO&nbsp;<br>这里getDependsOn() 并不是所想的成员字段依赖</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1085" y="1111" width="280" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-324" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-325" target="w4FkYv5Shg38tEnAdtc6-330" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-435" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-325" target="w4FkYv5Shg38tEnAdtc6-327" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-325" value="<font style=""><font style="font-size: 10px;">Object bean = <b>resolveBeforeInstantiation</b>(<br>beanName, mbdToUse);<br></font>if (bean != null) return bean;<br><font style="font-size: 10px;" color="#007fff">执行初始化前的后置处理器,</font><font color="#007fff">这一步可能创建代理Bean, 然后中断后续的创建流程</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="1840" y="1441" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-326" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-327" target="w4FkYv5Shg38tEnAdtc6-342" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-327" value="<font>Object <b>beanInstance</b> = <b>doCreateBean</b>(<br>beanName, mbdToUse, args);<br>return <b>beanInstance</b>;<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">
<mxGeometry x="1840" y="1680" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-328" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-330" target="w4FkYv5Shg38tEnAdtc6-332" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-329" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-330" target="w4FkYv5Shg38tEnAdtc6-333" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-330" value="<font style="font-size: 9px;">bean = applyBeanPostProcessorsBeforeInstantiation(<br>targetType, beanName)<br><font color="#007fff">这一步可能创建代理Bean,实际使用场景?</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2080" y="1441" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-331" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=10;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-332" target="w4FkYv5Shg38tEnAdtc6-335" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-438" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-332" target="w4FkYv5Shg38tEnAdtc6-437" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-332" value="<font>if (bean != null):&nbsp;<br>bean = applyBeanPostProcessorsAfterInitialization(<br>bean, beanName);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2080" y="1520" width="200" height="50" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-333" value="<font style="font-size: 10px"><font style="font-size: 10px">执行所有<b>InstantiationAwareBeanPostProcessor</b>类型后置处理器的&nbsp;<b>postProcessBeforeInstantiation</b>(<br>beanClass, beanName) 方法</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="1441" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-334" value="<div>instantiationAware = {ArrayList@1972}&nbsp; size = 3</div><div>&nbsp;0 = {ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor@1955}&nbsp;</div><div>&nbsp;1 = {CommonAnnotationBeanPostProcessor@1847}&nbsp;</div><div>&nbsp;2 = {AutowiredAnnotationBeanPostProcessor@1979}&nbsp;</div><div>但是这几个后置处理器的&nbsp;postProcessBeforeInstantiation() 都是null</div><div><br></div><div><div>以下是 InstantiationAwareBeanPostProcessor 接口的主要方法:</div><div>postProcessBeforeInstantiation: 在 bean 实例化之前调用,允许在实例化之前返回一个代理对象或者完全绕过实例化过程。</div><div>postProcessAfterInstantiation: 在 bean 实例化之后调用,允许对实例进行定制,例如为特定的字段设置默认值。</div><div>postProcessPropertyValues: 在设置 bean 属性之前调用,允许对属性值进行进一步的处理。</div><div>postProcessBeforeInitialization: 在调用 bean 的初始化方法之前调用,允许在初始化方法之前执行自定义逻辑。</div><div>postProcessAfterInitialization: 在调用 bean 的初始化方法之后调用,允许在初始化方法之后执行自定义逻辑。</div></div>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=10;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="2535" y="1439" width="570" height="160" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-335" value="<font>执行所有后置处理器的<br><b>postProcessAfterInitialization</b>(result, beanName)<br>方法<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="1519" width="200" height="51" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-336" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-344" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-337" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-345" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-338" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-346" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-339" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-348" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-340" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-343" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-443" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-342" target="w4FkYv5Shg38tEnAdtc6-442" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-342" value="<font><font size="1">instanceWrapper = <b>createBeanInstance</b>(<br>beanName, mbd, args);<br><font color="#007fff">这一步实现<b>Bean的实例化</b></font><br></font><font color="#007fff">根据BeanDefinition配置有5种获取Bean实例的方式, 从上到下优先级依次降低</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2080" y="1680" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-343" value="<font><font size="1">return obtainFromSupplier(instanceSupplier, beanName)<br></font><font color="#007fff">TODO</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2320" y="1680" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-344" value="<font><font size="1">return instantiateUsingFactoryMethod(beanName, mbd, args)<br></font><font color="#007fff">TODO</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2320" y="1760" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-345" value="<font><font size="1">return autowireConstructor(beanName, mbd, null, null)<br></font><font color="#007fff">TODO</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2320" y="1840" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-346" value="<font><font size="1">return autowireConstructor(beanName, mbd, ctors, args);<br></font><font color="#007fff">TODO</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2320" y="1920" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-347" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-348" target="w4FkYv5Shg38tEnAdtc6-352" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-348" value="<font><font size="1">return instantiateBean(beanName, mbd);</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2320" y="2000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-349" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-352" target="w4FkYv5Shg38tEnAdtc6-353" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-350" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-352" target="w4FkYv5Shg38tEnAdtc6-355" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-351" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-352" target="w4FkYv5Shg38tEnAdtc6-356" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-352" value="<font><font size="1">beanInstance = getInstantiationStrategy().<b>instantiate</b>(<br>mbd, beanName, parent);<br></font><font color="#007fff">默认的实例化策略是CglibSubclassingInstantiationStrategy</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2560" y="2000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-353" value="<font size="1"><div>BeanWrapper bw = new BeanWrapperImpl(beanInstance);</div><div><span>			</span>initBeanWrapper(bw);<br><font color="#007fff">包装了类型转换器,属性编辑器等等</font></div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2560" y="2080" width="200" height="51" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-355" value="<font style="font-size: 9px;"><font style="font-size: 9px;">final Class&lt;?&gt; <b>clazz</b> = bd.getBeanClass();<br><b>constructorToUse</b> = clazz.getDeclaredConstructor();<br>BeanUtils.<b>instantiateClass</b>(constructorToUse)<br></font><font style="font-size: 9px;" color="#007fff">通过反射调用构造方法创建</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2800" y="2000" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-356" value="<font style="font-size: 9px;"><font size="1">instantiateWithMethodInjection(bd, beanName, owner)<br></font><font style="font-size: 9px;" color="#007fff"><span style="">如果Bean定义有使用方法注入</span><span style="">,通过CGLib创建代理对象</span></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2800" y="2080" width="200" height="51" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-357" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-358" target="w4FkYv5Shg38tEnAdtc6-361" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-454" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-358" target="w4FkYv5Shg38tEnAdtc6-453" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-358" value="<font style="font-size: 9px;"><font style="font-size: 9px;">if (earlySingletonExposure)<br style="font-size: 9px;"></font><b style="font-size: 9px;">addSingletonFactory</b><font style="font-size: 9px;">(beanName, () -&gt; <b style="font-size: 9px;">getEarlyBeanReference</b>(beanName, mbd, bean));<br style="font-size: 9px;"></font><font color="#007fff" style="font-size: 9px;">Bean实例化后将单例工厂加入<b style="font-size: 9px;">singletonFactories</b><br style="font-size: 9px;"><font style="font-size: 9px;">earlySingletonExposure为true表示要提前暴露已经实例化的Bean</font></font><br style="font-size: 9px;"></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=9;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2070" y="2160" width="220" height="80" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-359" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-361" target="w4FkYv5Shg38tEnAdtc6-364" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-360" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-361" target="w4FkYv5Shg38tEnAdtc6-372" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-361" value="<font><font size="1">Object exposedObject = bean;<br></font><b>populateBean</b>(beanName, mbd, instanceWrapper);<br><font color="#007fff"><b>属性填充</b>:依赖注入、PropertyValues</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2080" y="2280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-362" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-364" target="w4FkYv5Shg38tEnAdtc6-465" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="2180" y="3360" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-363" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-364" target="w4FkYv5Shg38tEnAdtc6-386" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-364" value="<font><font size="1">exposedObject = <b>initializeBean</b>(beanName, exposedObject, mbd)<br></font><font color="#007fff"><b>执行初始化方法等等</b></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2080" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-365" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-465" target="w4FkYv5Shg38tEnAdtc6-369" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="2180" y="3540" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-367" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-369" target="w4FkYv5Shg38tEnAdtc6-370" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-368" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-369" target="w4FkYv5Shg38tEnAdtc6-409" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-369" value="<font><font size="1">registerDisposableBeanIfNecessary(<br>beanName, bean, mbd);<br></font><font color="#007fff"><span style="font-size: 8px">有些Bean销毁时需要执行销毁方法</span><br><span style="font-size: 8px">释放资源,这里将要执行销毁方法的Bean注册到disposableBeans Map容器</span></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2080" y="3700" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-370" value="<font><font size="1">return exposedObject;</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2080" y="4020" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-460" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-372" target="w4FkYv5Shg38tEnAdtc6-456" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-372" value="<font style="font-size: 9px;"><font style="font-size: 9px;">先执行所有<b>InstantiationAwareBeanPostProcessor</b>类型后置处理器的<b>postProcessAfterInstantiation</b>()<br></font><font style="font-size: 9px;" color="#007fff">内置的后置处理器此方法里面啥都没做,留给子类拓展</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="2280" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-377" value="<font><font size="1">autowireByName(beanName, mbd, bw, newPvs)</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2560" y="2320" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-378" value="<font><font size="1">autowireByType(beanName, mbd, bw, newPvs)</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2560" y="2400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-381" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-382" target="w4FkYv5Shg38tEnAdtc6-383" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-382" value="<font size="1"><div>if (pvs != null)&nbsp;</div><div>&nbsp; &nbsp; applyPropertyValues(</div><div>beanName, mbd, bw, pvs);</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2320" y="2800" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-383" value="<font size="1">bw.setPropertyValues(new MutablePropertyValues(deepCopy));<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2560" y="2800" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-384" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-386" target="w4FkYv5Shg38tEnAdtc6-389" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-385" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-386" target="w4FkYv5Shg38tEnAdtc6-393" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-463" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-386" target="w4FkYv5Shg38tEnAdtc6-395" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-464" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-386" target="w4FkYv5Shg38tEnAdtc6-396" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-386" value="<font><font size="1">invokeAwareMethods(beanName, bean)<br></font><font color="#007fff">如果Bean有实现Aware及其子类接口则执行这些接口方法</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2320" y="2880" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-387" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-389" target="w4FkYv5Shg38tEnAdtc6-399" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-388" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-389" target="w4FkYv5Shg38tEnAdtc6-401" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="EGC6r06OrjkvjnBetFEn-4" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-389" target="EGC6r06OrjkvjnBetFEn-3" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-389" value="<font><font size="1">执行所有<b>BeanPostProcessor</b>类型后置处理器的<b>postProcessBeforeInitialization</b>() 方法</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="3080" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-391" value="@PropertySource" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=9;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="2530" y="2290" width="90" height="20" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-393" value="<font><font size="1">BeanNameAware</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2560" y="2890" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-395" value="<font><font size="1">BeanClassLoaderAware</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2560" y="2950" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-396" value="<font><font size="1">BeanFactoryAware</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2560" y="3010" width="200" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-397" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=8;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-399" target="w4FkYv5Shg38tEnAdtc6-404" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-398" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-399" target="w4FkYv5Shg38tEnAdtc6-406" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-399" value="<font><font size="1">invokeInitMethods(beanName, wrappedBean, mbd);<br></font><font color="#007fff">调用@PostConstruct、init-method等制定的初始化方法、以及实现 InitializingBean 接口的&nbsp;afterPropertiesSet() 方法</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2320" y="3240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-401" value="<font style="font-size: 8px"><font style="font-size: 8px">Spring内置后置处理器的<b>postProcessBeforeInitialization</b>都做了啥<br></font><div>0 = {ApplicationContextAwareProcessor@2474}&nbsp;</div><div>1 = {ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor@2050}&nbsp;</div><div>2 = {PostProcessorRegistrationDelegate$BeanPostProcessorChecker@2535}&nbsp;</div><div>3 = {CommonAnnotationBeanPostProcessor@2091}&nbsp;</div><div>4 = {AutowiredAnnotationBeanPostProcessor@1994}&nbsp;</div><div>5 = {RequiredAnnotationBeanPostProcessor@2157}&nbsp;</div><div>6 = {ApplicationListenerDetector@2578}&nbsp;</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=7;" parent="1" vertex="1">
<mxGeometry x="2560" y="3070" width="300" height="80" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-403" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=8;fontColor=#007FFF;strokeColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-404" target="w4FkYv5Shg38tEnAdtc6-405" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-404" value="<font>((InitializingBean)bean).<b>afterPropertiesSet</b>()<br><font style="font-size: 8px" color="#007fff">实现了InitializingBean接口就调用afterPropertiesSet()</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2560" y="3240" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-405" value="<font style="font-size: 9px;"><font style="font-size: 9px;">String initMethodName = mbd.getInitMethodName();<br style="font-size: 9px;"></font><b>invokeCustomInitMethod</b>(beanName, bean, mbd);<br style="font-size: 9px;"><font color="#007fff" style="font-size: 9px;">若通过XML或注解指定了init-method方法,就执行指定的方法</font><br style="font-size: 9px;"></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=9;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2550" y="3320" width="220" height="60" as="geometry" />
</mxCell>
<mxCell id="EGC6r06OrjkvjnBetFEn-9" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-406" target="EGC6r06OrjkvjnBetFEn-8" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-406" value="<font><font size="1">执行所有<b>BeanPostProcessor</b>类型后置处理器的<b>postProcessAfterInitialization</b>()</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="3400" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-407" value="<font color="#007fff">Y</font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-409" target="w4FkYv5Shg38tEnAdtc6-413" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-408" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;dashed=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-409" target="w4FkYv5Shg38tEnAdtc6-422" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="2310" y="3745" />
<mxPoint x="2310" y="3970" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-409" value="!mbd.isPrototype() &amp;&amp; <b>requiresDestruction</b>(<br>bean, mbd)" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2345" y="3700" width="160" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-410" value="<font color="#000000"><b>requiresDestruction</b>:<br>1) DisposableBeanAdapter.hasDestroyMethod(bean, mbd)</font><br>是DisposableBean的实例;<br>是AutoCloseable的实例;<br>Bean定义中拥有<b>destroyMethod</b>方法(destoryMethodName不为空);<br><br><font color="#000000">2)&nbsp;<span>hasDestructionAwareBeanPostProcessors() &amp;&amp;</span></font><div><font color="#000000"><span>						</span>DisposableBeanAdapter.hasApplicableProcessors(bean, getBeanPostProcessors())</font></div><div>BeanFactory有注册DestructionAwareBeanPostProcessor;</div><div>且</div><div>注册的DestructionAwareBeanPostProcessor中有适用于当前Bean的后置处理器(通过 requiresDestruction() 返回值一一判断是否有适用的)</div>" style="text;html=1;strokeColor=none;fillColor=none;align=left;verticalAlign=top;whiteSpace=wrap;rounded=0;fontSize=9;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="2350" y="3760" width="310" height="150" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-411" value="<font color="#007fff">Y</font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-413" target="w4FkYv5Shg38tEnAdtc6-415" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-412" value="<font color="#007fff">N</font>" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-413" target="w4FkYv5Shg38tEnAdtc6-416" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-413" value="mbd.isSingleton()<br><font color="#007fff">是否是单例?</font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2600" y="3700" width="120" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-414" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-415" target="w4FkYv5Shg38tEnAdtc6-417" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-415" value="<div><b>registerDisposableBean</b>(beanName,</div><div><span>						</span>new <b>DisposableBeanAdapter</b>(bean, beanName, mbd, getBeanPostProcessors(), acc))</div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2800" y="3700" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-416" value="<div><b>scope</b>.<b>registerDestructionCallback</b>(<br>beanName,<span>new <b>DisposableBeanAdapter</b>(bean, beanName, mbd, getBeanPostProcessors(), acc))</span></div>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2800" y="3780" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-417" value="this.<b>disposableBeans</b>.put(<br>beanName, bean)<br><font color="#007fff">这里的bean是&nbsp;<b>DisposableBeanAdapter</b> 类型</font>" style="whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="3040" y="3700" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-418" value="disposableBeans并不是单指实现了<br>DisposableBean接口的Bean,<br>满足前面条件的Bean都会存到这个Map中" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=9;fontColor=#007FFF;" parent="1" vertex="1">
<mxGeometry x="3050" y="3760" width="180" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-419" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=9;fontColor=#007FFF;" parent="1" source="w4FkYv5Shg38tEnAdtc6-422" target="w4FkYv5Shg38tEnAdtc6-424" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-420" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=10;fontColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-422" target="w4FkYv5Shg38tEnAdtc6-429" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-421" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fontSize=10;fontColor=#000000;" parent="1" source="w4FkYv5Shg38tEnAdtc6-422" target="w4FkYv5Shg38tEnAdtc6-430" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-422" value="<font><font><font style="font-size: 10px">destoryMethod</font><font style="font-size: 8px">方法来源<br><font color="#007fff">查setDestroyMethodName调用位置</font></font></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2320" y="3940" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-424" value="<font><font size="1">@Bean destoryMethod属性</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2560" y="3920" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-429" value="<font><font size="1">XML Bean destory-method</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2560" y="3980" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-430" value="<font><font size="1">@PreDestroy</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2560" y="4040" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-434" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-431" target="w4FkYv5Shg38tEnAdtc6-325" edge="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1940" y="1440" as="targetPoint" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-431" value="<font>RootBeanDefinition mbdToUse = mbd;<br>Class&lt;?&gt; resolvedClass = <b>resolveBeanClass</b>(mbd, beanName);<br><font color="#007fff">从Bean定义中获取Bean Class类型</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="1840" y="1360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-433" value="<font color="#007fff">下面省略一些不重要的操作</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1855" y="1320" width="170" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-436" value="<font style="font-size: 10px;" color="#007fff">DEMO这一步并不会创建Bean</font>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="1855" y="1501" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-437" value="<font>mbd.beforeInstantiationResolved = (bean != null);<br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;" parent="1" vertex="1">
<mxGeometry x="2080" y="1590" width="200" height="50" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-441" value="<font color="#007fff" style="font-size: 10px;">CglibSubclassingInstantiationStrategy 继承 SimpleInstantiationStrategy<br>主要是为了支持方法注入。</font>" style="text;html=1;align=left;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" parent="1" vertex="1">
<mxGeometry x="2560" y="1940" width="340" height="40" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-444" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-442" target="w4FkYv5Shg38tEnAdtc6-358" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-442" value="<font style=""><font size="1"><b>applyMergedBeanDefinitionPostProcessors</b>(<br>mbd, beanType, beanName);<br></font><font color="#007fff">执行所有MergedBeanDefinitionPostProcessor<br>postProcessMergedBeanDefinition()</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2070" y="2080" width="220" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-448" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-446" target="w4FkYv5Shg38tEnAdtc6-74" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-451" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;" parent="1" source="w4FkYv5Shg38tEnAdtc6-446" target="w4FkYv5Shg38tEnAdtc6-450" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-446" value="<font style="font-size: 9px;"><b>beforeSingletonCreation</b>(beanName);<br><font color="#007fff">即主要记录名为 beanName 的Bean正在被创建</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=8;" parent="1" vertex="1">
<mxGeometry x="1360" y="1360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-478" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-447" target="w4FkYv5Shg38tEnAdtc6-477" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-447" value="<font style="font-size: 9px;"><b>afterSingletonCreation</b>(beanName);<br><font color="#007fff">和beforeSingletonCreation相反,清除beanName的Bean正在创建的记录</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=8;" parent="1" vertex="1">
<mxGeometry x="1360" y="1520" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-450" value="<font style="font-size: 8px;"><font style="font-size: 8px;">if (!this.inCreationCheckExclusions.contains(beanName) <br>&amp;&amp; !this.<b>singletonsCurrentlyInCreation</b>.add(beanName))<br></font>&nbsp; &nbsp;&nbsp;throw new BeanCurrentlyInCreationException(beanName);<br><font color="#007fff">实例化Bean前会将beanName记录到&nbsp;<b>singletonsCurrentlyInCreation</b></font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=8;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="1590" y="1360" width="220" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-453" value="<font style="font-size: 9px;"><div style="">synchronized (this.singletonObjects) {</div><div style="">&nbsp; &nbsp; if (!this.singletonObjects.containsKey(beanName))&nbsp; {</div><div style="">&nbsp; &nbsp; &nbsp; &nbsp; this.<b>singletonFactories</b>.<b>put</b>(beanName, singletonFactory);</div><div style="">&nbsp; &nbsp; &nbsp; &nbsp; this.<b>earlySingletonObjects</b>.<b>remove</b>(beanName);</div><div style="">&nbsp; &nbsp; &nbsp; &nbsp; this.<b>registeredSingletons</b>.<b>add</b>(beanName);</div><div style="">&nbsp; &nbsp; }</div><div style="">}</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=left;arcSize=4;fillColor=#fff2cc;strokeColor=#d6b656;" parent="1" vertex="1">
<mxGeometry x="2310" y="2150" width="230" height="100" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-457" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-456" target="w4FkYv5Shg38tEnAdtc6-377" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-458" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-456" target="w4FkYv5Shg38tEnAdtc6-378" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-461" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-456" target="w4FkYv5Shg38tEnAdtc6-380" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-456" value="<font><font size="1">@Autowired注入处理<br></font><font color="#007fff">这里处理按名称和类型的<b>Setter方法注入</b><br>DEMO中暂未用这两种注入,暂略</font><br></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#dae8fc;strokeColor=#6c8ebf;" parent="1" vertex="1">
<mxGeometry x="2320" y="2360" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-483" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-380" target="w4FkYv5Shg38tEnAdtc6-382" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-488" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-380" target="w4FkYv5Shg38tEnAdtc6-487" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-380" value="<font size="1"><div>执行所有<b>InstantiationAwareBeanPostProcessor</b>类型后置处理器的&nbsp;<b>postProcessProperties</b>()&nbsp;<br><b>postProcessPropertyValues</b>()</div></font>" style="rounded=1;whiteSpace=wrap;html=1;fontSize=10;align=center;arcSize=12;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">
<mxGeometry x="2320" y="2480" width="200" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-467" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-465" target="w4FkYv5Shg38tEnAdtc6-466" edge="1">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="EGC6r06OrjkvjnBetFEn-2" value="Y" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="w4FkYv5Shg38tEnAdtc6-467" vertex="1" connectable="0">
<mxGeometry x="-0.1048" relative="1" as="geometry">
<mxPoint as="offset" />
</mxGeometry>
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-465" value="<font style="">earlySingletonExposure<br></font>" style="rhombus;whiteSpace=wrap;html=1;fontSize=10;rounded=1;arcSize=10;" parent="1" vertex="1">
<mxGeometry x="2110" y="3500" width="140" height="60" as="geometry" />
</mxCell>
<mxCell id="w4FkYv5Shg38tEnAdtc6-468" style="edgeStyle=orthogonalEdgeStyle;rounded=1;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=-0.001;entryY=0.67;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="w4FkYv5Shg38tEnAdtc6-466" target="w4FkYv5Shg38tEnAdtc6-215" edge="1">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="3020" y="3530" />
<mxPoint x="3020" y="270" />