第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

classpath:spring-injection.xml 這里不懂。

這是哪一個知識點,在哪個文件配置的文件參數(shù)呢?看到這里一臉懵逼~~~

正在回答

4 回答

我大概明白,我沒有寫那個UnitTestBase 類,也沒有去繼承它。。。

所以super父類的構造方法肯定會報錯。。。暈菜,去看了下源碼才察覺到那個類是自定 義的測試類。0 - 0

0 回復 有任何疑惑可以回復我~
????????private?ApplicationContext?ctx;
	
	@Before
	public?void?init(){
		ctx=new??ClassPathXmlApplicationContext("spring-injection.xml");
	}
	
	
	@Test
	public?void?testSetter(){
		//ApplicationContext?ctx=new??ClassPathXmlApplicationContext("spring-injection.xml");
		InjectionService?service?=?(InjectionService)?ctx.getBean("injectionService");
		service.save("為什么會這樣子呢?");
	}

這是我根據(jù)helloworld方法改的測試方法,也可以實現(xiàn)。

不過就是不懂 super("XML文件") 為什么行不通。。

0 回復 有任何疑惑可以回復我~
package?com.imooc.test.ioc.injection;

import?org.junit.Test;
import?org.junit.runner.RunWith;
import?org.junit.runners.BlockJUnit4ClassRunner;

import?com.imooc.ioc.injection.service.InjectionService;

@RunWith(BlockJUnit4ClassRunner.class)
public?class?TestInjection?{

	public?TestInjection(){
		super("spring-injection.xml");
	}
	
	@Test
	public?void?testSetter(){
		//InjectionService?service?=?super
	}
}

super那個出錯了提示The constructor Object(String) is undefined

下面是我的項目結構,用的是myeclipse?

570471000001f1c602770229.jpg

5704710000017d6405000337.jpg

沒弄懂為什么super()出現(xiàn)什么問題,我上網去看一些helloworld可以用下面這方法讀取解析xml文件。

ApplicationContext ctx=new ?ClassPathXmlApplicationContext("applicationcontext.xml");

HelloWorld helloworld=(HelloWorld)ctx.getBean("helloworld");


0 回復 有任何疑惑可以回復我~

那個名字? 叫

spring-injection.xml

其實這個就行web.xml一樣的?? 懂沒? 只是名字變了而已

0 回復 有任何疑惑可以回復我~
#1

輝揚 提問者

public TestInjection(){ super("spring-injection.xml"); } 這個方法里面無論加不加 classpath都提示下面 The constructor Object(String) is undefined 我的xml文件是直接放在src下面的
2016-04-06 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

classpath:spring-injection.xml 這里不懂。

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號