问答详情
源自:1-3 实现一个自己的IoC

为什么报java.lang.NullPointerException

java.lang.NullPointerException

at com.imooc.spring.ioc.Class003Test.test(Class003Test.java:24)

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)

at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)

at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)

at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)

at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:305)

at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)

at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:365)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)

at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)

at org.junit.runners.ParentRunner$4.run(ParentRunner.java:330)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:78)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:328)

at org.junit.runners.ParentRunner.access$100(ParentRunner.java:65)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:292)

at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:305)

at org.junit.runners.ParentRunner.run(ParentRunner.java:412)

at org.junit.runner.JUnitCore.run(JUnitCore.java:137)

at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)

at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)

at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)

at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


提问者:想好好学习的懒人 2019-07-10 00:04

个回答

  • 慕虎1387559
    2019-07-11 21:22:34

    把代码贴上来,或者你自己打断点看