第一個(gè)dao空指針異常啊
java.lang.NullPointerException at org.seckill.dao.SeckillDaoTest.queryById(SeckillDaoTest.java:27) ?空指針啊,請(qǐng)問(wèn)這是為什么,哪里沒(méi)注入嗎
java.lang.NullPointerException at org.seckill.dao.SeckillDaoTest.queryById(SeckillDaoTest.java:27) ?空指針啊,請(qǐng)問(wèn)這是為什么,哪里沒(méi)注入嗎
舉報(bào)
2017-12-07
為了便于今后人的查詢(xún),我貼上我最終的解決方案:
原因?qū)Оe(cuò)誤
把包改成以下即可。
import org.junit.Test;
import org.junit.runner.RunWith;
import org.seckill.entity.Seckill;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.annotation.Resource;
import static org.junit.jupiter.api.Assertions.*;
2016-11-24
看你的測(cè)試的SeckillDao上面有沒(méi)有@Resource注解。
我調(diào)了整整兩天才發(fā)現(xiàn)。
框架就是難定位??!
希望幫到你!