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

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

老師這個(gè)有點(diǎn)坑?。。?  import org.junit.Test; 這里導(dǎo)入全部隱藏看不到導(dǎo)入什么??

public class TestOneInterface extends UnitTestBase{} 這里的UnitTestBase 是老師自己定義的類(lèi)吧   也沒(méi)提供  根本找不到?。?!



正在回答

2 回答

package com.imooc.test.base;


import org.junit.After;

import org.junit.Before;

import org.springframework.beans.BeansException;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import org.springframework.util.StringUtils;


public class UnitTestBase {

private ClassPathXmlApplicationContext context;

private String springXmlpath;

public UnitTestBase() {}

public UnitTestBase(String springXmlpath) {

this.springXmlpath = springXmlpath;

}

@Before

public void before() {

if (StringUtils.isEmpty(springXmlpath)) {

springXmlpath = "classpath*:spring-*.xml";

}

try {

context = new ClassPathXmlApplicationContext(springXmlpath.split("[,\\s]+"));

context.start();

} catch (BeansException e) {

e.printStackTrace();

}

}

@After

public void after() {

context.destroy();

}

@SuppressWarnings("unchecked")

protected <T extends Object> T getBean(String beanId) {

try {

return (T)context.getBean(beanId);

} catch (BeansException e) {

e.printStackTrace();

return null;

}

}

protected <T extends Object> T getBean(Class<T> clazz) {

try {

return context.getBean(clazz);

} catch (BeansException e) {

e.printStackTrace();

return null;

}

}


}


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

?UnitTestBase是自定義的類(lèi),import內(nèi)容如下:
import?org.junit.Test;
import?org.junit.runner.RunWith;
import?org.junit.runners.BlockJUnit4ClassRunner;
import?com.imooc.ioc.interfaces.OneInterface;
import?com.imooc.test.base.UnitTestBase;


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

quietwaltz

請(qǐng)問(wèn)UnitTestBase這個(gè)類(lèi)具體是怎么定義的?
2015-03-25 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

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

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

進(jìn)入課程
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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