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

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

關(guān)于Junit顯示名字找不到

<?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="OneInterface" class="com.imooc.ioc.interfaces.OneInterfaceImpl"></bean>

?</beans>

顯示 No bean named “OneInterface” is defined。 ?請問是為什么?

?private ClassPathXmlApplicationContext ctx;

?

@Before

public void init(){

ctx = new ClassPathXmlApplicationContext("classpath*:spring-ioc.xml");//如果在src目錄下則是classpath*:。如果在其他路徑則在classpath*:加入路徑名稱如spring/

ctx.start();

}

@Test

public void test(){

OneInterface oif = (OneInterface)ctx.getBean("OneInterface");//這里為什么會顯示找不到???????

System.out.println(oif.say("我輸入的參數(shù)"));

}

@After

public void destory(){

ctx.destroy();

}


正在回答

2 回答

是不是您的class名字寫錯了<剛開始我就是寫錯,運行不了>,http://img1.sycdn.imooc.com//580978390001553b12890567.jpg,我看了你的代碼,嘗試模仿運行,沒有錯啊。。。。。。

0 回復(fù) 有任何疑惑可以回復(fù)我~

我今天又看了下,發(fā)現(xiàn)有兩個問題。第一個是缺少一個jar包,二是getBean()當(dāng)中的大小寫錯誤了。非常感謝

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

老季

你少了什么包,我也一直抱著錯
2017-02-21 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

關(guān)于Junit顯示名字找不到

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號