<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國際加速解決方案。 廣告
                實例化spring ioc 容器是非常簡單直接的。只要實例化ApplicationContext就行,構造參數是資源字符串,指向各種外部資源路徑位置,例如本地文件系統,java classpath等待。 ~~~ java ApplicationContext context = new ClassPathXmlApplicationContext("services.xml", "daos.xml"); ~~~ 下面是服務層對象配置示例`(services.xml)` ~~~xml <?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 http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- services --> <bean id="petStore" class="org.springframework.samples.jpetstore.services.PetStoreServiceImpl"> <property name="accountDao" ref="accountDao"/> <property name="itemDao" ref="itemDao"/> <!-- 這里添加bean的配置和組合對象 --> </bean> <!-- 更多的服務層對象配置 --> </beans> ~~~ 下面是數據訪問層對象配置示例(daos.xml): ~~~xml <?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 http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="accountDao" class="org.springframework.samples.jpetstore.dao.jpa.JpaAccountDao"> <!-- 這里添加bean的配置和組合對象 --> </bean> <bean id="itemDao" class="org.springframework.samples.jpetstore.dao.jpa.JpaItemDao"> <!-- 這里添加bean的配置和組合對象 --> </bean> <!-- 更多的數據訪問層對象配置 --> </beans> ~~~ 在上面的示例中,服務層由類`PetStoreServiceImpl`和 兩個類型為`JpaAccountDao `和`JpaItemDao `的數據訪問對象組成,property元素的name引用了javaBean的屬性名稱。ref元素引用另一個定義的bean。元素id和ref之間的聯系表示合作對象的依賴關系。詳細的對象依賴配置,參考[依賴](https://docs.spring.io/spring/docs/5.0.6.RELEASE/spring-framework-reference/core.html#beans-dependencies) ### Composing XML-based configuration metadata 把xml配置文件分隔成多個是較好的做法,每個獨立的文件表示架構中一個業務邏輯或者模塊。 可以使用ApplicationContext的構造參數加載所有的xml配置文件,如一開始介紹的那樣。或者使用元素 <import/>加載其他配置文件,如下: ~~~xml <beans> <import resource="services.xml"/> <import resource="resources/messageSource.xml"/> <import resource="/resources/themeSource.xml"/> <bean id="bean1" class="..."/> <bean id="bean2" class="..."/> </beans> ~~~ 上面的示例,所有的外部bean配置來自三個文件,services.xml,messageSource.xml和themeSource.xml,所有文件的位置是相對于這個使用import的文件的,所以services.xml文件必須和此文件同目錄,messageSource.xml 和 themeSource.xml必須在此文件同目錄的resources目錄下。如你所見,開頭的斜線被忽略了,因為這是相對路徑,所以最好不要在開頭加斜線。import的文件必須符合spring schema規范。 import指令時bean命名空間本身提供的功能,另外spring還提供了更多可選的xml命名空間的特性,例如context和util
                  <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>

                              哎呀哎呀视频在线观看