<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ```xml <bean id="studentDao" class="dao.impl.StudentDaoImpl"/> <bean id="studentService" class="service.impl.StudentServiceImpl"> <property name="studentDao" ref="studentDao"/> </bean> ``` 使用自動裝配后`studentDao`屬性的注入可以簡化如下: ```xml <bean id="studentService" class="service.impl.StudentServiceImpl" autowire="byName"> <!-- <property name="studentDao" ref="studentDao"/> --> </bean> ``` 自動裝配由`autowire`屬性來控制,它的取值如下: | 值 | 作用 | | --- | --- | | no或default | 默認值。Spring默認不進行自動裝配,必須顯式指定依賴對象 | | byName | 根據屬性名自動裝配。Spring自動查找與屬性名相同的id,如果找到,則自動注入,否則什么都不做 | | byType | 根據屬性的類型自動裝配。Spring自動查找與屬性類型相同的Bean,如果剛好找到唯一的那個,則自動注入;如果找到多個與屬性類型相同的Bean,則拋出異常;如果沒找到,就什么也不做 | | constructor | 和byType類似,不過它針對構造方法。如果Spring 找到一個Bean和構造方法的參數類型相匹配,則通過構造注入該依賴對象;如果找不到,將拋出異常 | 可以為`<beans>`元素設置`default-autowire`屬性,影響全局,但`<bean>`節點`autowire`的設置可以覆蓋全局設置。 ```xml <beans .......default-autowire="byName"> !--省略其他代碼--> </beans> ``` 自動裝配使得配置文件可以非常簡潔,但同時也造成組件之間的依賴關系不明確,容易引發一些潛在的錯誤,在實際項目中要謹慎使用。
                  <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>

                              哎呀哎呀视频在线观看