日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 前端技术 > javascript >内容正文

javascript

【Spring】依赖注入 加载顺序

發(fā)布時(shí)間:2024/4/17 javascript 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【Spring】依赖注入 加载顺序 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

一、Spring依賴注入depents-on參數(shù)

depents-on是指指定Bean初始化及銷毀時(shí)的順序,使用depends-on屬性指定的是Bean要先初始化完畢后才初始化當(dāng)前Bean,由于只有Singleton Bean能被Spring管理銷毀,所以當(dāng)指定的Bean都是singleton時(shí),使用depends-on屬性指定的Bean要在指定的Bean之后銷毀

1、需要實(shí)體類以及配置文件測(cè)試實(shí)例 日志信息

1 package com.slp.spring.learn.helloworld.di; 2 3 import java.io.File; 4 import java.io.FileNotFoundException; 5 import java.io.FileOutputStream; 6 import java.io.IOException; 7 /** 8 * ResourceBean從配置文件中配置文件位置,然后定義初始化方法init中打開指定的文件,然后獲取文件流;最后定義銷毀方法destroy用于在應(yīng)用程序關(guān)閉時(shí)調(diào)用該方法關(guān)閉掉文件流 9 * @author sangliping 10 * 11 */ 12 public class ResourceBean { 13 14 private FileOutputStream fos; 15 private File file; 16 public void init(){ 17 System.out.println("ResourceBean:=============初始化"); 18 //加載資源,在此只是演示 19 System.out.println("ResourceBean:==============加載資源,執(zhí)行一些與操作"); 20 try { 21 fos=new FileOutputStream(file); 22 } catch (FileNotFoundException e) { 23 // TODO Auto-generated catch block 24 e.printStackTrace(); 25 } 26 } 27 28 public void destory(){ 29 System.out.println("ResourceBean:============銷毀"); 30 //釋放資源 31 System.out.println("ResourceBean:===========釋放資源,執(zhí)行一些清理操作"); 32 try { 33 fos.close(); 34 } catch (IOException e) { 35 // TODO Auto-generated catch block 36 e.printStackTrace(); 37 } 38 } 39 40 public FileOutputStream getFos() { 41 return fos; 42 } 43 44 public void setFos(FileOutputStream fos) { 45 this.fos = fos; 46 } 47 48 public File getFile() { 49 return file; 50 } 51 52 public void setFile(File file) { 53 this.file = file; 54 } 55 56 } package com.slp.spring.learn.helloworld.di;import java.io.IOException; /*** DependentBean中會(huì)注入ResourceBean,并從ResourceBean中獲取文件流寫入內(nèi)容;定義初始化方法init用來(lái)定義一些初始化操作并向文件中輸出文件頭信息;最后定義銷毀方法用于在關(guān)閉應(yīng)用程序時(shí)想文件中輸出文件尾信息。* @author sangliping**/ public class DependentBean {ResourceBean resourceBean;public void write(String ss) throws IOException {System.out.println("DependentBean:=======寫資源");resourceBean.getFos().write(ss.getBytes());}// 初始化方法public void init() throws IOException {System.out.println("DependentBean:=======初始化");resourceBean.getFos().write("DependentBean:=======初始化=====".getBytes());}// 銷毀方法public void destroy() throws IOException {System.out.println("DependentBean:=======銷毀");// 在銷毀之前需要往文件中寫銷毀內(nèi)容resourceBean.getFos().write("DependentBean:=======銷毀=====".getBytes());}public void setResourceBean(ResourceBean resourceBean) {this.resourceBean = resourceBean;} } <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"><bean id="resourceBean" class="com.slp.spring.learn.helloworld.di.ResourceBean" init-method="init" destroy-method="destory"><property name="file" value="D://test.txt"></property><!-- Spring容器可以自動(dòng)把字符串轉(zhuǎn)換為java.io.File --></bean><bean id="dependentBean" class="com.slp.spring.learn.helloworld.di.DependentBean" init-method="init" destroy-method="destroy" depends-on="resourceBean"><property name="resourceBean" ref="resourceBean"></property></bean> </beans> package com.slp.spring.learn.helloworld.di;import java.io.IOException;import org.junit.Test; import org.springframework.context.support.ClassPathXmlApplicationContext; /*2017-07-13 10:28:39,793 DEBUG main org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:107) Adding [systemProperties] PropertySource with lowest search precedence 2017-07-13 10:28:39,884 DEBUG main org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:107) Adding [systemEnvironment] PropertySource with lowest search precedence 2017-07-13 10:28:39,885 DEBUG main org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:126) Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2017-07-13 10:28:39,918 INFO main org.springframework.context.support.AbstractApplicationContext.prepareRefresh(AbstractApplicationContext.java:510) Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7c30a502: startup date [Thu Jul 13 10:28:39 CST 2017]; root of context hierarchy 2017-07-13 10:28:40,080 DEBUG main org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:107) Adding [systemProperties] PropertySource with lowest search precedence 2017-07-13 10:28:40,081 DEBUG main org.springframework.core.env.MutablePropertySources.addLast(MutablePropertySources.java:107) Adding [systemEnvironment] PropertySource with lowest search precedence 2017-07-13 10:28:40,086 DEBUG main org.springframework.core.env.AbstractEnvironment.<init>(AbstractEnvironment.java:126) Initialized StandardEnvironment with PropertySources [systemProperties,systemEnvironment] 2017-07-13 10:28:40,196 INFO main org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:315) Loading XML bean definitions from class path resource [di/depent-on.xml] 2017-07-13 10:28:40,201 DEBUG main org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:72) Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl] 2017-07-13 10:28:40,382 DEBUG main org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:140) Loading schema mappings from [META-INF/spring.schemas] 2017-07-13 10:28:40,394 DEBUG main org.springframework.beans.factory.xml.PluggableSchemaResolver.getSchemaMappings(PluggableSchemaResolver.java:146) Loaded schema mappings: {http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd=org/springframework/oxm/config/spring-oxm-3.0.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-3.2.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/jms/spring-jms-3.0.xsd=org/springframework/jms/config/spring-jms-3.0.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd=org/springframework/web/servlet/config/spring-mvc-3.1.xsd, http://www.springframework.org/schema/task/spring-task.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.1.xsd=org/springframework/beans/factory/xml/spring-beans-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop-3.0.xsd=org/springframework/aop/config/spring-aop-3.0.xsd, http://www.springframework.org/schema/task/spring-task-3.1.xsd=org/springframework/scheduling/config/spring-task-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm.xsd=org/springframework/oxm/config/spring-oxm-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd=org/springframework/jdbc/config/spring-jdbc-3.1.xsd, http://www.springframework.org/schema/tool/spring-tool-3.1.xsd=org/springframework/beans/factory/xml/spring-tool-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-3.1.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx-3.2.xsd=org/springframework/transaction/config/spring-tx-3.2.xsd, http://www.springframework.org/schema/context/spring-context-3.2.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/util/spring-util-3.2.xsd=org/springframework/beans/factory/xml/spring-util-3.2.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd=org/springframework/web/servlet/config/spring-mvc-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.2.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.0.xsd=org/springframework/beans/factory/xml/spring-beans-3.0.xsd, http://www.springframework.org/schema/cache/spring-cache-3.2.xsd=org/springframework/cache/config/spring-cache-3.2.xsd, http://www.springframework.org/schema/task/spring-task-3.0.xsd=org/springframework/scheduling/config/spring-task-3.0.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.2.xsd=org/springframework/oxm/config/spring-oxm-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd=org/springframework/jdbc/config/spring-jdbc-3.0.xsd, http://www.springframework.org/schema/jms/spring-jms-3.2.xsd=org/springframework/jms/config/spring-jms-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.0.xsd=org/springframework/beans/factory/xml/spring-tool-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-3.2.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop-3.2.xsd=org/springframework/aop/config/spring-aop-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee-3.0.xsd=org/springframework/ejb/config/spring-jee-3.0.xsd, http://www.springframework.org/schema/tx/spring-tx-3.1.xsd=org/springframework/transaction/config/spring-tx-3.1.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/context/spring-context-3.1.xsd=org/springframework/context/config/spring-context-3.1.xsd, http://www.springframework.org/schema/util/spring-util-3.1.xsd=org/springframework/beans/factory/xml/spring-util-3.1.xsd, http://www.springframework.org/schema/lang/spring-lang-3.1.xsd=org/springframework/scripting/config/spring-lang-3.1.xsd, http://www.springframework.org/schema/cache/spring-cache-3.1.xsd=org/springframework/cache/config/spring-cache-3.1.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-3.2.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.2.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/oxm/spring-oxm-3.1.xsd=org/springframework/oxm/config/spring-oxm-3.1.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-3.2.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/mvc/spring-mvc.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd, http://www.springframework.org/schema/jms/spring-jms-3.1.xsd=org/springframework/jms/config/spring-jms-3.1.xsd, http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd=org/springframework/web/servlet/config/spring-mvc-3.2.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc.xsd=org/springframework/jdbc/config/spring-jdbc-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-3.2.xsd=org/springframework/beans/factory/xml/spring-beans-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-3.1.xsd=org/springframework/aop/config/spring-aop-3.1.xsd, http://www.springframework.org/schema/task/spring-task-3.2.xsd=org/springframework/scheduling/config/spring-task-3.2.xsd, http://www.springframework.org/schema/tx/spring-tx-3.0.xsd=org/springframework/transaction/config/spring-tx-3.0.xsd, http://www.springframework.org/schema/context/spring-context-3.0.xsd=org/springframework/context/config/spring-context-3.0.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/util/spring-util-3.0.xsd=org/springframework/beans/factory/xml/spring-util-3.0.xsd, http://www.springframework.org/schema/lang/spring-lang-3.0.xsd=org/springframework/scripting/config/spring-lang-3.0.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd=org/springframework/jdbc/config/spring-jdbc-3.2.xsd, http://www.springframework.org/schema/tool/spring-tool-3.2.xsd=org/springframework/beans/factory/xml/spring-tool-3.2.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd} 2017-07-13 10:28:40,398 DEBUG main org.springframework.beans.factory.xml.PluggableSchemaResolver.resolveEntity(PluggableSchemaResolver.java:118) Found XML schema [http://www.springframework.org/schema/beans/spring-beans-3.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-3.0.xsd 2017-07-13 10:28:40,633 DEBUG main org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:106) Loading bean definitions 2017-07-13 10:28:40,698 DEBUG main org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216) Loaded 2 bean definitions from location pattern [di/depent-on.xml] 2017-07-13 10:28:40,700 DEBUG main org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:540) Bean factory for org.springframework.context.support.ClassPathXmlApplicationContext@7c30a502: org.springframework.beans.factory.support.DefaultListableBeanFactory@1e6d1014: defining beans [resourceBean,dependentBean]; root of factory hierarchy 2017-07-13 10:28:40,763 DEBUG main org.springframework.context.support.AbstractApplicationContext.initMessageSource(AbstractApplicationContext.java:807) Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@7a187f14] 2017-07-13 10:28:40,817 DEBUG main org.springframework.context.support.AbstractApplicationContext.initApplicationEventMulticaster(AbstractApplicationContext.java:831) Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@27808f31] 2017-07-13 10:28:40,818 INFO main org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:603) Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e6d1014: defining beans [resourceBean,dependentBean]; root of factory hierarchy 2017-07-13 10:28:40,820 DEBUG main org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:215) Creating shared instance of singleton bean 'resourceBean' 2017-07-13 10:28:40,821 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:432) Creating instance of bean 'resourceBean' 2017-07-13 10:28:40,844 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:506) Eagerly caching bean 'resourceBean' to allow for resolving potential circular references 2017-07-13 10:28:40,936 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1612) Invoking init method 'init' on bean with name 'resourceBean' ResourceBean:=============初始化 ResourceBean:==============加載資源,執(zhí)行一些與操作 2017-07-13 10:28:40,966 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:460) Finished creating instance of bean 'resourceBean' 2017-07-13 10:28:40,967 DEBUG main org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) Returning cached instance of singleton bean 'resourceBean' 2017-07-13 10:28:40,972 DEBUG main org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:215) Creating shared instance of singleton bean 'dependentBean' 2017-07-13 10:28:40,972 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:432) Creating instance of bean 'dependentBean' 2017-07-13 10:28:40,974 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:506) Eagerly caching bean 'dependentBean' to allow for resolving potential circular references 2017-07-13 10:28:40,977 DEBUG main org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) Returning cached instance of singleton bean 'resourceBean' 2017-07-13 10:28:40,980 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1612) Invoking init method 'init' on bean with name 'dependentBean' DependentBean:=======初始化 2017-07-13 10:28:40,982 DEBUG main org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:460) Finished creating instance of bean 'dependentBean' 2017-07-13 10:28:40,984 DEBUG main org.springframework.context.support.AbstractApplicationContext.initLifecycleProcessor(AbstractApplicationContext.java:858) Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [org.springframework.context.support.DefaultLifecycleProcessor@b3d7190] 2017-07-13 10:28:40,985 DEBUG main org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) Returning cached instance of singleton bean 'lifecycleProcessor' 2017-07-13 10:28:40,995 DEBUG main org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:81) Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties] 2017-07-13 10:28:41,023 DEBUG main org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:81) Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment] 2017-07-13 10:28:41,028 DEBUG main org.springframework.core.env.PropertySourcesPropertyResolver.getProperty(PropertySourcesPropertyResolver.java:103) Could not find key 'spring.liveBeansView.mbeanDomain' in any property source. Returning [null] 2017-07-13 10:28:41,066 DEBUG main org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) Returning cached instance of singleton bean 'dependentBean' DependentBean:=======寫資源 2017-07-13 10:28:41,114 INFO Thread-0 org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1042) Closing org.springframework.context.support.ClassPathXmlApplicationContext@7c30a502: startup date [Thu Jul 13 10:28:39 CST 2017]; root of context hierarchy 2017-07-13 10:28:41,116 DEBUG Thread-0 org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) Returning cached instance of singleton bean 'lifecycleProcessor' 2017-07-13 10:28:41,116 INFO Thread-0 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:444) Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e6d1014: defining beans [resourceBean,dependentBean]; root of factory hierarchy 2017-07-13 10:28:41,116 DEBUG Thread-0 org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:303) Invoking destroy method 'destroy' on bean with name 'dependentBean' DependentBean:=======銷毀 2017-07-13 10:28:41,117 DEBUG Thread-0 org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:303) Invoking destroy method 'destory' on bean with name 'resourceBean' ResourceBean:============銷毀 ResourceBean:===========釋放資源,執(zhí)行一些清理操作 */ public class MoreDependencyInjectTest {@Testpublic void testDependOn() throws IOException{ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("di/depent-on.xml");//注冊(cè)銷毀回調(diào) 否則定義的銷毀方法不執(zhí)行 context.registerShutdownHook();DependentBean dependent = context.getBean("dependentBean", DependentBean.class);dependent.write("測(cè)試寫入數(shù)據(jù)");} }

?

轉(zhuǎn)載于:https://www.cnblogs.com/dream-to-pku/p/7159378.html

總結(jié)

以上是生活随笔為你收集整理的【Spring】依赖注入 加载顺序的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 欧美在线一级 | 中文在线不卡视频 | 超碰在线伊人 | 欧美被狂躁喷白浆精品 | 精品一性一色一乱农村 | 黄在线免费观看 | 国产成人在线观看免费 | 成人免费一级 | 6080成人 | 久久国产人妻一区二区免色戒电影 | 国产大学生视频 | 亚洲涩涩网站 | 奇米影视狠狠干 | 国产高清免费在线播放 | 捆绑调教在线观看 | 在线xxxxx| 超碰人人爱人人 | 久久97| 善良的女朋友在线观看 | 俺也去婷婷 | 久草福利免费 | 欧美va视频| 国产精品久久久久av | 国产欧美久久一区二区三区 | 密桃av在线 | 这里只有久久精品 | 一边摸内裤一边吻胸 | av有码在线观看 | 性高湖久久久久久久久免费 | 91成人免费电影 | 国产精品正在播放 | 麻豆av影院| 国产午夜三级 | 处女朱莉 | 久久大胆视频 | 黄色片亚洲 | 第一章豪妇荡乳黄淑珍 | 无码一区二区三区视频 | 日韩高清在线观看一区 | 91久久伊人 | 欧美日韩精品一区二区 | 国产精品.xx视频.xxtv | 男女在线观看 | 福利国产片 | 国产在线拍揄自揄拍无码 | 亚洲一区免费在线观看 | 成人3d动漫一区二区三区 | 日韩激情精品 | 国产98在线 | 玉女心经是什么意思 | a久久久久久| 中文在线不卡 | 无毒黄色网址 | 久草福利在线视频 | a级黄色网 | 午夜av网址 | 国产拍拍拍拍拍拍拍拍拍拍拍拍拍 | 欧美色图在线观看 | 制服诱惑一区 | 三级视频网址 | 91插视频 | 卡一卡二在线视频 | 成人依依网| 欧美另类v| 午夜少妇 | 亚洲4p| 美女下部无遮挡 | 精品国产中文字幕 | 日本无遮羞调教打屁股网站 | 欧美日韩视频 | 天堂成人国产精品一区 | 日韩久草 | 中文字幕无线码一区 | 国产91丝袜在线播放九色 | 一区二区日韩在线观看 | av中文字幕在线播放 | 欧美大胆视频 | 亚洲国产精品成人va在线观看 | 婷婷激情视频 | 国产人妖网站 | 国产乱子伦精品无码码专区 | wwwxxx在线观看| 亚洲国产精品久久久久 | 在线看免费av | 深夜福利免费在线观看 | 久热免费在线视频 | 国产99久久 | 六月丁香在线视频 | 99热这里只有精品3 成年人黄色网址 | 欧美午夜精品一区二区三区电影 | 美女脱了内裤喂我喝尿视频 | 三级黄毛片| 三级理伦| 国产伦理吴梦梦伦理 | 人妻视频一区二区三区 | 午夜精品视频一区二区三区在线看 | 日本资源在线 | 激情插插| 噜噜噜精品欧美成人 |