鍩轰簬spring 3.1.0.
IoC鍜孉OP鏄痵pring鐨勫熀纭€銆傚厛鐪婭oC銆傛帴鍙d互BeanFactory鍜孉pplicationContext涓轰腑蹇冿紝abstractBeanFactory鏈夊緢澶氬疄鐜般€備粠ClassPathXmlApplicationContext寮€濮嬨€?娣诲姞浜唕esource绠$悊)銆備粠refresh()寮€濮嬨€?br>鍒濆鍖?br>聽 Resource Loader
聽 load BeanDefinition
聽聽聽 Reader
聽聽聽 register
聽聽聽聽聽 documentReader
聽聽聽聽聽 BeanDefinitionParserDelegate
聽 Registry(FactoryBeanRegistrySupport.ConcurrentHashMap)
渚濊禆娉ㄥ叆(getBean), abstractBeanFactory.getObjectForBeanInstance(),
FactoryBeanRegistrySupport.getObjectFromFactoryBean(),doGetObjectFromFactoryBean(),娉ㄦ剰杩欓噷factory.getObject();瀹炵幇FactoryBean.
鍒濆鍖栧彧鏄痩oad beanDefinition锛屾敞鍏ュ湪getBean鏃跺彂鐢燂紝鑻ユ湁寰幆寮曠敤瀵箂ingleton涓嶄細鏈夐棶棰橈紝瀵筽rototype鏈夋娴嬶紝鑻ヨ寮曠敤bean鍒欏湪creating涓垯鎶涘紓甯搞€?br>
--AOP
姒傚康锛歛dvice, pointcut, advisor.
浠roxyFactoryBean涓轰緥銆傚畠鏄竴涓狟eanFactoryAware鍙緱鍒癇eanFactory锛屽悓鏃跺湪init Bean鐨勬椂鍊欎細璋冨叾getObject鏂规硶鍥犳鍙疄鐜板叾Factory鐨勪綔鐢ㄨ繑鍥瀙roxy銆俛opproxy鏈変袱绉嶏細jdk**proxy, cglib**proxy锛屼互涓嶅悓鐨勬柟寮?鍒嗗埆璋僫nvoke, intercept)鍦ㄥ叾涓皟鐢≧eflectiveMethodInvocation.proceed()銆傝嫢娌℃湁advise鍒欑洿鎺ヨ皟鐢ㄦ柟娉曪紝鏈塵akeAccessible銆?/p>
鏉ョ湅proceed()銆備粠chain涓彇matcher(advisor)鎴杋nterceptor锛屽墠鑰呮牴鎹叾matcher璋僫nterceptor鍚庤€呯洿鎺ヨ皟銆?/p>
鏉ョ湅chain鎬庝箞浠庨厤缃腑鏉ャ€傚叾鏉ヨ嚜***Proxy涓殑AdvisedSupport advised;浠巊etInterceptorsAndDynamicInterceptionAdvice鍏ユ墜锛屽叾浠嶥efaultAdvisorChainFactory涓锛岀敱AdvisorAdapterRegistry瀹屾垚锛岃€屽弬鏁版潵鑷簬AdvisedSupport鐨刟dvisors.杩欎釜advisors瑕佸洖鍒?strong>ProxyFactoryBean.initializeAdvisorChain(),浠巄eanFactory.getBean()鍙栧緱advice骞禷dd, ProxyBeanFactory鏄竴涓猘utowirecapableBeanFactory鎵€浠ュ湪init瀹冭嚜韬殑鏃跺€欎細琚缃瓸eanFactory鏈韩锛岀粰浜堝畠鎰熺煡factory鐨勮兘鍔涖€?/p>
娉ㄦ剰浠ヤ笂姒傚康锛屾垜浠缁囧叆鐨勬槸advice锛屼絾鏄痗hain閲屾槸interceptor锛岃繖閲屾湁涓嶄竴鑷淬€傝繖灏辨槸adapter鐨勪綔鐢ㄣ€備笁绉峚dviceAdapter灏哸dvice鍖呰鎴恑nterceptor锛屾斁鍒癱hain涓€傚寘瑁呯殑鏃跺€欏垎鍒畬鎴恇efore, after, around绛夊姛鑳姐€?/p>