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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

為什么老是找不到bean的名字啊?一直提示報(bào)錯(cuò)

RT 就老是出現(xiàn)找不到bean的樣子

http://img1.sycdn.imooc.com//594aa3c0000132a905440249.jpg

http://img1.sycdn.imooc.com//594aa3c000019cbc07750264.jpg

http://img1.sycdn.imooc.com//594aa3c10001e30607480146.jpg

http://img1.sycdn.imooc.com//594aa3c1000100bd07150035.jpg


正在回答

1 回答

//這個(gè)是java文件
package?com.imooc.beanannotation;

import?org.springframework.stereotype.Component;

@Component
public?class?BeanAnnotation?{
	
	public?void?say(String?word){
		System.out.println("BeanAnnotation:"+word);
	}

}
//這個(gè)是配置文件
<?xml?version="1.0"?encoding="UTF-8"?>
<beans
	xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans?
			http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
			http://www.springframework.org/schema/context
			http://www.springframework.org/schema/context/spring-context-3.1.xsd">
<context:component-scan?base-package="com.imooc.beanannotation">
</context:component-scan>		

</beans>
//這個(gè)是測(cè)試的文件,,我沒(méi)安裝老師那個(gè)方法,而是直接實(shí)例化
@Test
public?void?TestbeanAnnotation()?{
????????ApplicationContext?alc=new?ClassPathXmlApplicationContext("spring-beanannotation.xml");
	BeanAnnotation?bean=(BeanAnnotation)alc.getBean("beanAnnotation");
	bean.say("fuck");
		
	}


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

舉報(bào)

0/150
提交
取消
Spring入門篇
  • 參與學(xué)習(xí)       268802    人
  • 解答問(wèn)題       1017    個(gè)

為您帶來(lái)IOC和AOP的基本概念及用法,為后續(xù)高級(jí)課程學(xué)習(xí)打下基礎(chǔ)

進(jìn)入課程

為什么老是找不到bean的名字啊?一直提示報(bào)錯(cuò)

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

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

幫助反饋 APP下載

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

公眾號(hào)

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