狠狠色丁香婷婷久久综合麻豆,国产99久久久久久免费看,与亲女洗澡时伦了视频,一面膜胸口一面膜下免费

spring如何實現(xiàn)兩個xml配置文件間的互調(diào)

這篇文章主要介紹了spring如何實現(xiàn)兩個xml配置文件間的互調(diào),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下

專注于為中小企業(yè)提供網(wǎng)站制作、成都網(wǎng)站制作服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)巴林左旗免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了成百上千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

首先建兩個測試類

package soundsystem;
public class Dog {
  private String Cry;
  private Cat Cat;
  public void setCry(String cry) {
    Cry = cry;
  }
  public void setCat(soundsystem.Cat cat) {
    Cat = cat;
  }
  public void DogCry(){
    System.out.println("狗叫:"+Cry);
    Cat.CatCry();
  }
}
package soundsystem;
public class Cat {
  private String Cry;
  public Cat(String cry){
    this.Cry=cry;
  }
  public void CatCry(){
    System.out.println("貓叫:"+Cry);
  }
}

然后針對兩類建兩個xml配置文件

Bean_DogXML.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">

  <import resource="Bean_CatXML.xml"></import>

  <bean id="Dog" class="soundsystem.Dog">
    <property name="Cry" value="汪汪汪~"></property>
    <property name="cat" ref="Cat"></property>
  </bean>

</beans>

Bean_CatXML.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="Cat" class="soundsystem.Cat">
    <constructor-arg value="喵喵~"></constructor-arg>
  </bean>
</beans>

現(xiàn)在開始測試:

package Test;

import org.junit.runner.RunWith;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import soundsystem.Cat;
import soundsystem.Dog;
@RunWith(SpringJUnit4ClassRunner.class)
public class Test {
  @org.junit.Test
  public static void main(String[] args) {
    ApplicationContext ap=new ClassPathXmlApplicationContext("config/Bean_DogXML.xml");
    Dog dog=(Dog)ap.getBean("Dog");
    dog.DogCry();
  }
}

輸出結(jié)果是:

spring如何實現(xiàn)兩個xml配置文件間的互調(diào)

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持創(chuàng)新互聯(lián)。

新聞標(biāo)題:spring如何實現(xiàn)兩個xml配置文件間的互調(diào)
本文鏈接:http://www.hntjjpw.com/article48/jsddep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT自適應(yīng)網(wǎng)站定制網(wǎng)站靜態(tài)網(wǎng)站關(guān)鍵詞優(yōu)化響應(yīng)式網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站建設(shè)
主站蜘蛛池模板: 抚顺县| 旬邑县| 庆元县| 张家界市| 石狮市| 苏尼特左旗| 陈巴尔虎旗| 罗源县| 凤冈县| 老河口市| 沁源县| 宣化县| 永城市| 西昌市| 怀柔区| 旺苍县| 昌黎县| 金昌市| 手游| 来凤县| 沽源县| 启东市| 澜沧| 广安市| 正宁县| 买车| 台南市| 呼图壁县| 迭部县| 武胜县| 多伦县| 南充市| 新蔡县| 牙克石市| 定南县| 内丘县| 合川市| 茌平县| 随州市| 中卫市| 怀远县|