junit進行測試載入多個spring配置檔案
阿新 • • 發佈:2019-02-13
配置方式如下:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:/applicationContext_realm.xml",
"classpath*:/applicationContext_daily.xml",
"classpath*:/applicationContext.xml",
"classpath*:/applicationContext_airwarm.xml" ,
"classpath*:/applicationContext_airwet.xml",
"classpath*:/applicationContext_illum.xml",
"classpath*:/applicationContext_rainfall.xml"
})
public class testRealmEbo {
@Autowired
private RealmEbi realmEbi;
@Autowired
private SoilRealmAction soilRealmAction;
@Test
public void test1(){
realmEbi.getLatestData(RealmApplianceModel.sendData1+RealmApplianceModel.service1);
// String services = realmEbi.getAllServices();
// System.out.println(services);
}
@Test
public void test2(){
realmEbi.insertDaily("check&!&admin&!&admin&!&select&!&rangedata&!&360702AA01&!&2018-01-07&!&2018-01-07&!&day");
}