posts - 64,comments - 22,trackbacks - 0
               摘要: 使用Spring注解注入屬性2009-06-15 17:48 kenshin54 JavaEye博客 我要評論(0) 字號:T | T本文介紹了使用Spring注解注入屬性的方法。使用注解以前,注入屬性通過類以及配置文件來實現(xiàn)。現(xiàn)在,注入屬性可以通過引入@Autowired注解,或者@Resource,@Qualifier,@PostConstruct,@P...  閱讀全文
          posted @ 2011-11-21 12:31 hellxoul 閱讀(1662) | 評論 (0)編輯 收藏

          原文出自liuxilil
          關(guān)鍵字: lazy-init,init-method,destroy-method,depends-on的說明

           lazy-init,init-method,destroy-method,depends-on的說明(這4個是Spring 1就有的)

          1. lazy-init是否延遲初始化
          2. init-method指定初始化方法
          3. destroy-method指定銷毀方法
          4. depends-on指定依賴的bean(指定bean的初始化順序)
            1 Xml代碼 
            2 <bean id="bean11" class="test.impl.Bean11" lazy-init="true" init-method="init" destroy-method="destroy" depends-on="bean1"/>  
            3 <bean id="bean12" class="test.impl.Bean12" lazy-init="false" init-method="init" destroy-method="destroy" depends-on="bean2"/>  
            4   
            5 <bean id="bean1" class="test.impl.Bean1" init-method="init" destroy-method="destroy" lazy-init="true"/>  
            6 <bean id="bean2" class="test.impl.Bean2" init-method="init" destroy-method="destroy" />  

            說明:

            1  一個bean的生命周期是constructor->init->destroy
            2   lazy-init決定了bean的初始化時機(jī)  (bean1和bean11在被調(diào)用時,bean2和bean12在ApplicationContext初始化時)
            3   depends-on決定了beans的初始化順序(bean11在bean1初始化后,bean22在bean2初始化后)和銷毀順序(bean11在bean1銷毀前,bean22在bean2銷毀前)
          posted @ 2011-11-21 09:22 hellxoul 閱讀(665) | 評論 (0)編輯 收藏
               摘要:
          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-2.5.xsd
          http://www.springframework.org/schema/context
          http://www.spr  閱讀全文
          posted @ 2011-11-19 15:44 hellxoul 閱讀(51216) | 評論 (7)編輯 收藏
               摘要: 在spring2.0之前bean只有2種作用域即:singleton(單例)、non-singleton(也稱prototype),Spring2.0以后,增加了session、request、global session三種專用于Web應(yīng)用程序上下文的Bean。因此,默認(rèn)情況下Spring2.0現(xiàn)在有五種類型的Bean。當(dāng)然,Spring2.0對Bean的類型的設(shè)計進(jìn)行了重構(gòu),并設(shè)計出靈活的Bean類型支持,理論上可以有無數(shù)多種類型的Bean,用戶可以根據(jù)自己的需要,增加新的Bean類型,滿足實際應(yīng)用需求。  閱讀全文
          posted @ 2011-11-19 15:24 hellxoul 閱讀(292) | 評論 (0)編輯 收藏
          哈哈,今天開始自己的blog
          posted @ 2011-11-19 15:05 hellxoul 閱讀(128) | 評論 (0)編輯 收藏
               摘要:   閱讀全文
          posted @ 2011-11-19 15:02 hellxoul 閱讀(233) | 評論 (0)編輯 收藏
          僅列出標(biāo)題
          共7頁: 上一頁 1 2 3 4 5 6 7 
          主站蜘蛛池模板: 梅州市| 岳池县| 东源县| 孟连| 乐昌市| 和顺县| 遵化市| 大荔县| 罗江县| 南靖县| 上林县| 遵义县| 东乡族自治县| 苍梧县| 昭苏县| 佛坪县| 牟定县| 普兰县| 望谟县| 霍邱县| 昔阳县| 乐都县| 佛冈县| 南丰县| 阿克| 遵义市| 临沂市| 五常市| 桃园县| 道孚县| 金寨县| 深圳市| 宁夏| 广东省| 密云县| 清流县| 博罗县| 合江县| 丰原市| 台南市| 图木舒克市|