<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ~~~ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd"> <!--把對象的創建交給spring來管理--> <!-- bean對象的生命周期 單例對象: 出生: 當容器創建時對象出生 活著: 只要容器還在,對象一直活著 死亡: 容器銷毀,對象消亡 總結: 單例對象的生命周期和容器相同 多例對象: 出生: 當我們使用對象時spring框架為我們創建 活著: 對象只要是在使用過程中就一直活著 死亡: 當對象長時間不用,且沒有別的對象引用時,由java的垃圾回收器回收 --> <bean id="accountService4" class="com.itheima.service.impl.AccountServiceImpl4" scope="singleton" init-method="init" destroy-method="destory"></bean> <!----> <!-- <bean id="accountService5" class="com.itheima.service.impl.AccountServiceImpl5" scope="prototype" init-method="init" destroy-method="destory"></bean>--> </beans> ~~~ ***** ~~~ package com.itheima.service.impl; import com.itheima.service.IAccountService; /** * @author: hcf * @qq: 46914685 * @email: 46914685@qq.com */ /** * 賬戶的業務層實現類 */ public class AccountServiceImpl4 implements IAccountService { //沒有構造函數,所以采用第一種方式創建bean時會出錯 // public AccountServiceImpl1(String name) { public AccountServiceImpl4() { System.out.println("對象創建了"); } public void saveAccount() { System.out.println("service中的saveAccount方法執行了!44444"); } public void init(){ System.out.println("對象初始化了..."); } public void destory(){ System.out.println("對象銷毀了..."); } } ~~~ ***** ~~~ package com.itheima.service.impl; import com.itheima.service.IAccountService; /** * @author: hcf * @qq: 46914685 * @email: 46914685@qq.com */ /** * 賬戶的業務層實現類 */ public class AccountServiceImpl5 implements IAccountService { //沒有構造函數,所以采用第一種方式創建bean時會出錯 // public AccountServiceImpl1(String name) { public AccountServiceImpl5() { System.out.println("對象創建了55"); } public void saveAccount() { System.out.println("service中的saveAccount方法執行了!55555"); } public void init(){ System.out.println("對象初始化了55..."); } public void destory(){ System.out.println("對象銷毀了55..."); } } ~~~ ***** ~~~ /** * 測試bean生命周期--單例對象生命周期 */ @Test public void testSingletonLifeCycle() { //1.獲取核心容器對象 ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("bean2.xml"); //創建bean對象 IAccountService as = ac.getBean("accountService4", IAccountService.class); as.saveAccount(); //手動銷毀容器 ac.close(); } /** * 測試bean生命周期--多例對象生命周期 */ @Test public void testPrototypeLifeCycle(){ ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("bean2.xml"); IAccountService as = (IAccountService) ac.getBean("accountService5"); as.saveAccount(); ac.close(); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看