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

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

4.1節(jié)當(dāng)中我將Scope改成了prototype,為啥返回的還是同一對(duì)象?

package?com.imooc.test.beanannotation;

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

import?com.imooc.beanannotation.BeanAnnotation;
import?com.imooc.test.base.UnitTestBase;

@RunWith(BlockJUnit4ClassRunner.class)
public?class?TestBeanAnnotation?extends?UnitTestBase?{
	
	public?TestBeanAnnotation()?{
		super("classpath*:spring-beanannotation.xml");
	}
	
	
	@Test
	public?void?testScpoe()?{
		BeanAnnotation?bean?=?super.getBean("beanAnnotation");
		bean.myHashCode();
		
		bean?=?super.getBean("beanAnnotation");
		bean.myHashCode();
	}
	
}
package?com.imooc.beanannotation;

import?org.springframework.context.annotation.Scope;
import?org.springframework.stereotype.Component;

//@Component("bean")
@Scope("prototype")
@Component
public?class?BeanAnnotation?{
	public?void?myHashCode()?{
		System.out.println("BeanAnnotation?:?"?+?this.hashCode());
	}
	
}

兩個(gè)bean輸出的hashcode是一樣的

BeanAnnotation?:?2039473569
BeanAnnotation?:?2039473569

正在回答

1 回答

應(yīng)該是對(duì)一個(gè)store子類@scope(value)吧

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

星辰Iron 提問者

已經(jīng)解決了,我把程序關(guān)閉重新啟動(dòng)一下就可以了,估計(jì)是緩存的問題。
2017-09-10 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

4.1節(jié)當(dāng)中我將Scope改成了prototype,為啥返回的還是同一對(duì)象?

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

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

幫助反饋 APP下載

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

公眾號(hào)

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