##特别
由于准备春招,所以希望各位看客方便的话,能去github上面帮我Star一下项目
https://github.com/Draymonders/Campus-Shop
java.lang.NullPointerException
at com.cumt.service.ShopCategoryServiceTest.testGetShopCategoryList(ShopCategoryServiceTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
public class ShopCategoryServiceTest{ @Autowired private ShopCategoryService shopCategoryService; @Test public void testGetShopCategoryList() { if(shopCategoryService == null) { System.out.println("shopCategoryService is null"); } } }
卡在空指针异常 卡了一个小时 才发现 忘记加载
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration({"classpath:spring/spring-dao.xml", "classpath:spring/spring-service.xml"})