• Mybatis的mapper使用springbootTest报错Find why ‘xxxMapper‘ could be null


    报错:Find why userMapper‘ could be null

    在测试类调试报错:
    在这里插入图片描述
    报错信息:

    java.lang.NullPointerException at
    com.sutao.gdc.GdcApplicationTests.ee(GdcApplicationTests.java:146) 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.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:725)
    at
    org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at
    org.junit.jupiter.engine.execution.InvocationInterceptorChain V a l i d a t i n g I n v o c a t i o n . p r o c e e d ( I n v o c a t i o n I n t e r c e p t o r C h a i n . j a v a : 131 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x t e n s i o n . T i m e o u t E x t e n s i o n . i n t e r c e p t ( T i m e o u t E x t e n s i o n . j a v a : 149 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x t e n s i o n . T i m e o u t E x t e n s i o n . i n t e r c e p t T e s t a b l e M e t h o d ( T i m e o u t E x t e n s i o n . j a v a : 140 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x t e n s i o n . T i m e o u t E x t e n s i o n . i n t e r c e p t T e s t M e t h o d ( T i m e o u t E x t e n s i o n . j a v a : 84 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x e c u t i o n . E x e c u t a b l e I n v o k e r ValidatingInvocation.proceed(InvocationInterceptorChain.java:131) at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140) at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84) at org.junit.jupiter.engine.execution.ExecutableInvoker ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)atorg.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)atorg.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)atorg.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)atorg.junit.jupiter.engine.execution.ExecutableInvokerReflectiveInterceptorCall.lambda$ofVoidMethod 0 ( E x e c u t a b l e I n v o k e r . j a v a : 115 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x e c u t i o n . E x e c u t a b l e I n v o k e r . l a m b d a 0(ExecutableInvoker.java:115) at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda 0(ExecutableInvoker.java:115)atorg.junit.jupiter.engine.execution.ExecutableInvoker.lambdainvoke 0 ( E x e c u t a b l e I n v o k e r . j a v a : 105 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . e x e c u t i o n . I n v o c a t i o n I n t e r c e p t o r C h a i n 0(ExecutableInvoker.java:105) at org.junit.jupiter.engine.execution.InvocationInterceptorChain 0(ExecutableInvoker.java:105)atorg.junit.jupiter.engine.execution.InvocationInterceptorChainInterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at
    org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at
    org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at
    org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at
    org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at
    org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at
    org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod 7 ( T e s t M e t h o d T e s t D e s c r i p t o r . j a v a : 214 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . T e s t M e t h o d T e s t D e s c r i p t o r . i n v o k e T e s t M e t h o d ( T e s t M e t h o d T e s t D e s c r i p t o r . j a v a : 210 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . T e s t M e t h o d T e s t D e s c r i p t o r . e x e c u t e ( T e s t M e t h o d T e s t D e s c r i p t o r . j a v a : 135 ) a t o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . T e s t M e t h o d T e s t D e s c r i p t o r . e x e c u t e ( T e s t M e t h o d T e s t D e s c r i p t o r . j a v a : 66 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 7(TestMethodTestDescriptor.java:214) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135) at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 7(TestMethodTestDescriptor.java:214)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:210)atorg.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)atorg.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:66)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 6 ( N o d e T e s t T a s k . j a v a : 151 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 6(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 6(NodeTestTask.java:151)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 8 ( N o d e T e s t T a s k . j a v a : 141 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e . a r o u n d ( N o d e . j a v a : 137 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 8(NodeTestTask.java:141)atorg.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 9 ( N o d e T e s t T a s k . j a v a : 139 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e R e c u r s i v e l y ( N o d e T e s t T a s k . j a v a : 138 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e ( N o d e T e s t T a s k . j a v a : 95 ) a t j a v a . u t i l . A r r a y L i s t . f o r E a c h ( A r r a y L i s t . j a v a : 1249 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . i n v o k e A l l ( S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . j a v a : 41 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 9(NodeTestTask.java:139)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)atjava.util.ArrayList.forEach(ArrayList.java:1249)atorg.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 6 ( N o d e T e s t T a s k . j a v a : 155 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 6(NodeTestTask.java:155)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 8 ( N o d e T e s t T a s k . j a v a : 141 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e . a r o u n d ( N o d e . j a v a : 137 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 8(NodeTestTask.java:141)atorg.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 9 ( N o d e T e s t T a s k . j a v a : 139 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e R e c u r s i v e l y ( N o d e T e s t T a s k . j a v a : 138 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e ( N o d e T e s t T a s k . j a v a : 95 ) a t j a v a . u t i l . A r r a y L i s t . f o r E a c h ( A r r a y L i s t . j a v a : 1249 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . i n v o k e A l l ( S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . j a v a : 41 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.util.ArrayList.forEach(ArrayList.java:1249) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 9(NodeTestTask.java:139)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)atjava.util.ArrayList.forEach(ArrayList.java:1249)atorg.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 6 ( N o d e T e s t T a s k . j a v a : 155 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 6(NodeTestTask.java:155)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 8 ( N o d e T e s t T a s k . j a v a : 141 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e . a r o u n d ( N o d e . j a v a : 137 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . l a m b d a 8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda 8(NodeTestTask.java:141)atorg.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.lambdaexecuteRecursively 9 ( N o d e T e s t T a s k . j a v a : 139 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 73 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e R e c u r s i v e l y ( N o d e T e s t T a s k . j a v a : 138 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . N o d e T e s t T a s k . e x e c u t e ( N o d e T e s t T a s k . j a v a : 95 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . s u b m i t ( S a m e T h r e a d H i e r a r c h i c a l T e s t E x e c u t o r S e r v i c e . j a v a : 35 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . H i e r a r c h i c a l T e s t E x e c u t o r . e x e c u t e ( H i e r a r c h i c a l T e s t E x e c u t o r . j a v a : 57 ) a t o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . H i e r a r c h i c a l T e s t E n g i n e . e x e c u t e ( H i e r a r c h i c a l T e s t E n g i n e . j a v a : 54 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . E n g i n e E x e c u t i o n O r c h e s t r a t o r . e x e c u t e ( E n g i n e E x e c u t i o n O r c h e s t r a t o r . j a v a : 107 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . E n g i n e E x e c u t i o n O r c h e s t r a t o r . e x e c u t e ( E n g i n e E x e c u t i o n O r c h e s t r a t o r . j a v a : 88 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . E n g i n e E x e c u t i o n O r c h e s t r a t o r . l a m b d a 9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda 9(NodeTestTask.java:139)atorg.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)atorg.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)atorg.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)atorg.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)atorg.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)atorg.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)atorg.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)atorg.junit.platform.launcher.core.EngineExecutionOrchestrator.lambdaexecute 0 ( E n g i n e E x e c u t i o n O r c h e s t r a t o r . j a v a : 54 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . E n g i n e E x e c u t i o n O r c h e s t r a t o r . w i t h I n t e r c e p t e d S t r e a m s ( E n g i n e E x e c u t i o n O r c h e s t r a t o r . j a v a : 67 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . E n g i n e E x e c u t i o n O r c h e s t r a t o r . e x e c u t e ( E n g i n e E x e c u t i o n O r c h e s t r a t o r . j a v a : 52 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . D e f a u l t L a u n c h e r . e x e c u t e ( D e f a u l t L a u n c h e r . j a v a : 114 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . D e f a u l t L a u n c h e r . e x e c u t e ( D e f a u l t L a u n c h e r . j a v a : 86 ) a t o r g . j u n i t . p l a t f o r m . l a u n c h e r . c o r e . D e f a u l t L a u n c h e r S e s s i o n 0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession 0(EngineExecutionOrchestrator.java:54)atorg.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)atorg.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)atorg.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)atorg.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)atorg.junit.platform.launcher.core.DefaultLauncherSessionDelegatingLauncher.execute(DefaultLauncherSession.java:86)
    at
    org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
    at
    com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
    at
    com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at
    com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

    解决方法:

    在这里插入图片描述
    自己在测试时,因为在不关联项目中的类时测试,去掉@SpringBootTest注解,运行会快很多,所以事先把它去掉了。
    但是在需要关联项目中的类时,必须加上,比如对user类的增删查改等;
    在测试user类时,忘记加@SpringBootTest注解了,导致报错,把注解加上就好了。
    报错原因有多种情况,视具体情况解决。

  • 相关阅读:
    qt程序中,如何做才能用到OpenGL ES图形api
    分布式系统的一致性与共识(1)-综述
    在AOSP中根据设备特性进行个性化定制:利用getPackageManager().hasSystemFeature()接口实现
    SwiftUI 4.0(iOS 16+)使用新的 Gauge 视图极简实现仪表盘外观
    大规模 IoT 边缘容器集群管理的几种架构-3-Portainer
    风电场统计数据名词
    RedisTemplate的操作和用法
    gerrit部署使用
    【LeetCode每日一题】——404.左叶子之和
    案例研究丨神策数据在多项目、多网络场景下使用JumpServer堡垒机
  • 原文地址:https://blog.csdn.net/weixin_44797539/article/details/126155843