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

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

Cannot find the class file for org.springframework.context.ApplicationContextInitializer.

jdk是1.8,有沒有同學能幫下忙啊,搞了一天了,謝謝謝謝

第一個報錯:Description?? ?Resource?? ?Path?? ?Location?? ?Type
The project was not built since its build path is incomplete. Cannot find the class file for org.springframework.context.ApplicationContextInitializer. Fix the build path then try building this project?? ?seckill?? ??? ?Unknown?? ?Java Problem
第二個報錯:Description?? ?Resource?? ?Path?? ?Location?? ?Type
The type org.springframework.context.ApplicationContextInitializer cannot be resolved. It is indirectly referenced from required .class files?? ?SeckillDaoTest.java?? ?/seckill/src/test/java/org/seckill/dao?? ?line 1?? ?Java Problem


正在回答

10 回答

換另一個版本的jar包就解決了。

0 回復 有任何疑惑可以回復我~

一樣的問題 重新下載了spring-context 搞定

0 回復 有任何疑惑可以回復我~

樓主,解決了嗎我也是這個問題

0 回復 有任何疑惑可以回復我~

如果加載不成功呢,可能就是包的問題,,,, 如果你的其他代碼寫的都對

0 回復 有任何疑惑可以回復我~

我和你一樣的問題,重新下載spring-context包就好了


0 回復 有任何疑惑可以回復我~

這是我的代碼:


package org.seckill.dao;


import static org.junit.Assert.*;


import java.util.Date;

import java.util.List;


import org.junit.Test;

import org.junit.runner.RunWith;

import org.seckill.entity.Seckill;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.test.context.ContextConfiguration;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;


/**

?* 配置spring與junit的整合,junit啟動時加載spring容器

?*spring-test,junit

?*/

@RunWith(SpringJUnit4ClassRunner.class)

//告訴junit spring配置文件

@ContextConfiguration({"classpath:spring/spring-dao.xml"})

public class SeckillDaoTest {


//注入dao實現(xiàn)類依賴

@Autowired

private SeckillDao seckillDao;

@Test

public void testReduceNumber() {

Date killTime=new Date();

int updateCount=seckillDao.reduceNumber(1000L, killTime);

System.out.println("updateCount="+updateCount);

}


@Test

public void testQueryById() {

long id=1000;

Seckill seckill=seckillDao.queryById(id);

System.out.println(seckill.getName());

System.out.println(seckill);

/*

* 1000元秒殺iphone6

Seckill [seckillId=1000, name=1000元秒殺iphone6, number=100, startTime=Sun Nov 01 00:00:00 CST 2015, endTime=Mon Nov 02 00:00:00 CST 2015, createTime=Sat Apr 08 13:52:31 CST 2017]

*/

}


@Test

public void testQueryAll() {

//java沒有保存形參的記錄:queryAll(int offset,int limit)->queryAll(arg0,arg1)

List<Seckill>seckills=seckillDao.queryAll(0, 100);

for(Seckill seckill:seckills){

System.out.println(seckill);

}

/*

* Seckill [seckillId=1000, name=1000元秒殺iphone6, number=100, startTime=Sun Nov 01 00:00:00 CST 2015, endTime=Mon Nov 02 00:00:00 CST 2015, createTime=Sat Apr 08 13:52:31 CST 2017]

Seckill [seckillId=1001, name=500元秒殺ipad2, number=200, startTime=Sun Nov 01 00:00:00 CST 2015, endTime=Mon Nov 02 00:00:00 CST 2015, createTime=Sat Apr 08 13:52:31 CST 2017]

Seckill [seckillId=1002, name=300元秒殺小米4, number=300, startTime=Sun Nov 01 00:00:00 CST 2015, endTime=Mon Nov 02 00:00:00 CST 2015, createTime=Sat Apr 08 13:52:31 CST 2017]

Seckill [seckillId=1003, name=200元秒殺紅米note, number=400, startTime=Sun Nov 01 00:00:00 CST 2015, endTime=Mon Nov 02 00:00:00 CST 2015, createTime=Sat Apr 08 13:52:31 CST 2017]

*/

}


}


0 回復 有任何疑惑可以回復我~

不是你的代碼的問題啊同學,她的報錯信息顯示的是buildpath不完整,你去看看構建路徑唄。注釋了那句代碼就不報錯的話那就是你的導包錯誤了:是這個:import org.springframework.test.context.ContextConfiguration;

如果還不行的話其他配置文件要確定沒有錯,也有可能是你的maven下載jar包不正確,刪掉讓maven重下那個jar(springframework-test)可能就不會錯了。

0 回復 有任何疑惑可以回復我~

@ContextConfiguration({"classpath:spring/spring-dao.xml"}) 把這行代碼注釋掉就不報錯了,說明還是這加載錯了,但是不知道錯在哪,文件夾建錯了嗎???

0 回復 有任何疑惑可以回復我~

http://img1.sycdn.imooc.com//58e8e7770001656313660736.jpg我寫的是這樣的 上邊那個圖是老師的,我用的win10+eclipse,我懷疑是不是那個spring的文件夾不對啊,寫的和老師都一樣啊,首行就報錯,而且不能用resource注解autowired也不行,應該是spring的問題

0 回復 有任何疑惑可以回復我~

要這樣寫的

@ContextConfiguration({"classpath:spring/spring-dao.xml"})

你的代碼沒有寫配置文件的路徑當然報錯

0 回復 有任何疑惑可以回復我~
#1

青檸3159128 提問者

那個是老師的截屏,我寫的在下邊,卡了一天了,很難過,幫忙看一下吧同學
2017-04-08 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

Cannot find the class file for org.springframework.context.ApplicationContextInitializer.

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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