千山鳥飛絕 萬徑人蹤滅
          勤練內(nèi)功,不斷實踐招數(shù)。爭取早日成為武林高手

          public class PersonServiceBean implements IPersonService {

           public void init(){
            
            System.out.println("我是初始化函數(shù)");
           }
           
           public PersonServiceBean(){
            System.out.println("我是構(gòu)造函數(shù)");
           }
           public void Save(){
            System.out.println("save方法");
           }
           
           public void cleanup(){
            System.out.println("cleanup方法");
           }
          }


          <bean id="personService"
            class="cn.itcast.service.impl.PersonServiceBean"
             init-method="init" destroy-method="cleanup"/>

          @Test public void instanceSpring(){
            ClassPathXmlApplicationContext ctx=new ClassPathXmlApplicationContext("beans.xml");
            IPersonService ipersonService=(IPersonService)ctx.getBean("personService");
           ctx.close();

          posted on 2009-08-26 10:32 笑口常開、財源滾滾來! 閱讀(186) 評論(0)  編輯  收藏 所屬分類: spring學(xué)習(xí)
           
          主站蜘蛛池模板: 溆浦县| 龙山县| 商洛市| 鄂托克前旗| 教育| 高清| 华容县| 墨玉县| 招远市| 伊金霍洛旗| 泾源县| 邹平县| 天津市| 西峡县| 荔波县| 花莲县| 锦州市| 镇江市| 将乐县| 沈阳市| 黔江区| 涟源市| 扬中市| 河西区| 尼木县| 博野县| 梧州市| 泰兴市| 甘肃省| 怀远县| 东乡| 中山市| 侯马市| 潼关县| 黄梅县| 乌鲁木齐市| 罗田县| 仁布县| 黄骅市| 乐亭县| 屯留县|