Changes between Version 22 and Version 23 of waue/2011/spring


Ignore:
Timestamp:
Aug 26, 2011, 5:02:34 PM (13 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2011/spring

    v22 v23  
    410410}}}
    411411
    412 
    413 
    414 
    415 
    416 
    417 
    418 
    419412 === 自動綁定 ===
    420413[http://caterpillar.onlyfun.net/Gossip/SpringGossip/AutoWiring.html autowire (詳細)] 測試後not work,也許與Spring 版本有關
     414
     415 == bean 生命週期 ==
     416
     417在Spring中,從BeanFactory或ApplicationContext取得的實例為 Singleton,預設是每一個Bean別名維持一個實例,對單執行緒的程式來說並不會有什麼問題,但對於多執行緒的程式,您必須注意到執行緒安全,您也可以設定每次取得Bean時都產生一個新的實例,例如:
     418
     419{{{
     420#!java
     421<bean id="helloBean"
     422      class="onlyfun.caterpillar.HelloBean"
     423      singleton="false">
     424}}}
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
    421438
    422439 = Dependency Injection =