资源描述:
《Spring_源代码解析——入门》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
ᙠRod.JohnsonḄீீProfessionalJavaDevelopmentwiththespringframeworkுுṹ⍝Ẉ᳝ᨵᐶ$Ḅ%&'()Ẇᔳ,ᙠSpring-IOC.ᘤḄ0⌕ᙢ3ᡃ56789:;SpringḄ<ᵨὅ?@IOC.ᘤA▭CDEFᕖHᡃ5IJ9BeanFactory6Dᡃ5ᑮḄloC.ᘤLᯠSpringNᡃ5OᜓQ8RloC.ᘤᩭ<ᵨT᪵IJVᡃ5W7%ḄX☢7%ḄZ3[7%Ḅ\]Ḅ^_`aᩭbcᡃ5◤⌕ḄloC.ᘤᙠSpring-ᨬghḄIOC.ᘤijDBeanFactory-TijNᐹlḄIOC.ᘤḄAmnᨬghḄopq^-7stFḼnNIOC.ᘤTvijwxy⌕z{|ᵨ}~Ḅᨬgh⌕Javaṹ1.publicinterfaceBeanFactory{2.3.TD:FactoryBeanḄ_^_N<ᵨbeanḄFactoryBeanᑮḄ:DᔆᡂḄ:4.◤⌕ᑮᔆh◤_5.StringFACTORY_BEAN_PREFIX=6.7.8.T᪷beanḄ,ᙠIOC.ᘤ-ᑮbeanA,TIOC.ᘤ6DᜧḄI.ᔆ9.ObjectgetBean(Stringname)throwsBeansException;10.11.T᪷beanḄClassᩭᑮbeanAC☢ḄV7%ᙠ;᪷¡ḄbeanAḄClass◤⌕Ḅ7%Ḅ¢12.ObjectgetBean(Stringname,ClassrequiredType)throwsBeansException;13.14.T£¤:beanḄDᔲᙠIOC.ᘤᨵTḄbean15.booleancontainsBean(Stringname);16.17.T᪷beanᑮbeanA¦%§ᑨ©TbeanD7Dᓫ«18.booleanisSingleton(Stringname)throwsNoSuchBeanDefinitionException;19.20.T:ᑮbeanAḄClass21.ClassgetType(Stringname)throwsNoSuchBeanDefinitionException;22.23.TᑮbeanḄ¬,᪷¬,Fᐸ¯°ᩭ24.String[]getAliases(Stringname);25.26.}ᙠBeanFactory±:IOC.ᘤḄgh²Nn^_᪷h7ᐵ´wḄbeanDt᪵^_t᪵µ¶Ḅ-6·ᡃ5±ᐵ´WTᔆᡃ5ᑮᑮEF¸¹:º;ᔆDtF¸Tv:ḄTghḄij7ᐵ´Tv⌕ᐵ´ᔆDt᪵¸:Ḅ|ᵨ}~◤⌕<ᵨᐹlḄIOC.ᘤAm-LᯠwIJ»¼᪷TBeanFactoryᩭAm»¼ḄIOC.ᘤ½T¾ᨵx⌕NSpring¿ÀNᡃ5OᜓÁÂᑡᔆᩭÄᡃ5<ᵨÅXmÆeanFactory6D┐:ᨬgẠḄBeanFactoryḄIOC.ᘤḄAm-
1TAm<ᵨxmlᩭ^_100.ᘤ-ḄbearioSpring£¤BeanFactoryḄghAm,XmÆeanFactory%᪵ḄÉÊ<ᵨËÌË]ᩭᑮ:I0C.ᘤḄ-AbstractBeanFactory,DefaultListableBeanFactoryTvNᐸ£¤ËÌÍÎᐸ-ÉÊresourceijᩭbean^_ᦪ:Xml^_ᦻ«ḄÑ᪆ÉÊÓᡲÕXmlBeanDefinitionReaderᩭÖᡂ×☢ᡃ5᪷ØCḄÙÚᓫḄÛÜI0C.ᘤḄÝbÊ}Javaṹ1.ClassPathResourceres=newClassPathResource("beans.xml");2.DefaultListableBeanFactoryfactory=newDefaultListableBeanFactory();3.XmlBeanDefinitionReaderreader=newXmlBeanDefinitionReader(factory);4.reader.loadBeanDefinitions(res);TvṹÛÜJ×Þßà1.ÝbI0Cá[ᦻ«ḄZ2.ÝbBeanFactory3.âã¡á[`aḄBeanDefinäonReader,TDXmlBeanDefinitionReaderá[ÕBeanFactory4.W^_ÁḄZ3[ãᐭá[`aᐹlḄÑ᪆Ê}ᵫXmÆeanDefinitionReaderᩭÖᡂT᪵Öᡂ¶ᐭbean^_ḄÊ}ᡃ5ḄloC.ᘤ6bc'ᩭᙠBeanFactoryḄṹ-ᡃ5IJᑮJavaṹ1.publicclassXmlBeanFactoryextendsDefaultListableBeanFactory{2.TN.ᘤ^_è<ᵨḄbean^_ã¡ᘤ3.privatefinalXmlBeanDefinitionReaderreader=newXmlBeanDefinitionReader(this);4.publicXmlBeanFactory(Resourceresource)throwsBeansException{5.this(resource,null);6.}7.ᙠéêᓄìᦪ-<ᵨã¡ᘤᩭ:Zí²ã¡,ᑮbean^_`a8.publicXmlBeanFactory(Resourceresource,BeanFactoryparentBeanFactory)throwsBeansException{9.super(parentBeanFactory);10.this.reader.loadBeanDefinitions(resource);11.)ᡃ5ᙠî☢ᑮã¡ᘤã¡Zïðbean^_`aḄÊ}ghCDC×ᦻḄᜐᳮD᪵ḄWTᡃ5IJᑮC×ᦻXmÆeanFactoryTóRI0C.ᘤḄô¬BeanFactoryõõ7ᐹᜓ:Z^_Ḅpö?C×ᦻIJ»¼ÖᡂZ^_WT÷øCC×ᦻùÁᵨvúûᑖ᪆SpringBeanFactoryḄý᪀ᡃ5ᩭᙠBeanFactorygẠC ḄApplicationcontext-ᡃᨬᵨḄᦻ◀ᐹᜓBeanFactoryḄᐰᦻᵨᑭ!*$%&ᢝ()Ḅ*+,ᡃ-.I/Applicationcontext MessageSource*123,45ᙠ7ResourceLoader8ResourceḄ&ᢝ☢:᪵ᡃ$%<()ᙢ>?ᑮbeanAB3,*&ᢝᵨCDEFGHApplicationEventPublisher,:᪵ᙠᦻIJᐭCDLᑴNBeanFactoryOPᨵḄApplicationContextᐕᦻSᝅ-VWXᢝ᱄ᦻ$%Zᢝ[\ᦻ4]-:\4]ᡃᙠ%^7Web_ᘤIḄᦻaḄᑖ᪆I$%efᙢ-ᑮ7gbeanḄhi$%ᙠ:\ᦻ4]Ijk✌ᐜnhopᦻᐸrO᱄ᦻ⌲tᔣ:᪵()ḄSpringᵨvw[\ᐳyḄbean
2ABa:\ᡃᙠᑖ᪆Web_ᘤIḄᦻaz{-ᑮApplicationcontextvwloC_ᘤḄ|⌕GHᙠᐸ4]Iᨵ~AbstractApplicationContextᐹ4ḄBeanFactoryḄ5FileSystemXmlApplicationContext8ClassPathXmlApplicationContextvw.ᦻḄ?◤⌕ᐵᐹ4Ḅ3,A2⚪oᵨṹᓄFileSystemXmlApplicationContextḄz?.ijloC_ᘤḄ[ᐹ4⊤5-Applicationcontext,