花费了一下午都没有搜索到相关解决方案的原因,一是我使用的 UnsatisfiedDependencyException 这个比较上层的异常(在最前面)来进行搜索,
范围太广导致没有搜索到,而且即便是有人提出是包扫描的问题,但是我spring的基础太差,所以也不知道该怎么操作,
然后这次又印证了我之前的那篇博客,即碰到异常一定要找到根异常,参考我之前的文章: java spring 等启动项目时的异常 或 程序异常的解决思路;
根异常一般在异常行的末尾,这次就是搜索末尾的 {@org.springframework.beans.factory.annotation.Autowired(required=true)} ,才搜索到下面的这篇解决的博客的,
注:这个问题跟类名,方法名,idea版本 没有任何关系。
注:每次使用springtest进行非web的测试时,都需要按照下面的正确示例来写注解,并且设置idea resources为 test resources,并且在 applicationContext.xml 中,
把包扫描 设置为 自动配置 <context:annotation-config /> ,否则会报 BeanCreationException: Error creating bean with name
参考:https://blog.csdn.net/zixiao217/article/details/52959886/
applicationContext.xml
<!-- 将以下内容替换 --> <context:component-scan base-package="org.kinome"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"></context:exclude-filter> </context:component-scan> <!-- 替换为 --> <context:annotation-config />
这里是包扫描出现了问题导致的,原因不明,
不过如果替换成了这个的话,项目启动时会有一些启动类出现注入问题,所以如果要做springtest的话,用替换为的包扫描自动配置,如果要启动项目的话,就换回替换之前的包扫描配置。(两个配置不用哪个注释掉就可以了,当做选项灵活配置)
注意: 如果仅仅做springtest,不涉及web,那么就只加载 applicationContext.xml 就可以了,否则会报错。
正确示例:
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:applicationContext.xml") public class TestExample { @Autowired AssetsDevicetypeRefactorMapper assetsDevicetypeRefactorMapper; @Test public void test() { AssetsDevicetypeRefactorExample example = new AssetsDevicetypeRefactorExample(); AssetsDevicetypeRefactorExample.Criteria criteria = example.createCriteria(); example.or().andIscustomizeEqualTo("N"); example.or().andInfosysidEqualTo(1); List<AssetsDevicetypeRefactor> assetsDevicetypeRefactors = assetsDevicetypeRefactorMapper.selectByExample(example); for (AssetsDevicetypeRefactor adr : assetsDevicetypeRefactors ) { System.out.println(adr.getName()); } } }
要想正常使用springtest,还需要把resources设置为 test resources
下面是只引入 applicationContext.xml ,但是包扫描没有用自动配置,而是用的那个自定义的包扫描(也就是上面那个长的),做springtest时出现的异常
"C:Program FilesJavajdk1.8.0_151injava.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:7284,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:C:UsersAdministrator.IntelliJIdea2018.3systemcaptureAgentdebugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2libidea_rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit-rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit5-rt.jar;C:Program FilesJavajdk1.8.0_151jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_151jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_151jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_151jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_151jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_151jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_151jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_151jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_151jrelibextmysql-connector-java-5.1.28-bin.jar;C:Program FilesJavajdk1.8.0_151jrelibext ashorn.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_151jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_151jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_151jrelibjce.jar;C:Program FilesJavajdk1.8.0_151jrelibjfr.jar;C:Program FilesJavajdk1.8.0_151jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_151jrelibjsse.jar;C:Program FilesJavajdk1.8.0_151jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_151jrelibplugin.jar;C:Program FilesJavajdk1.8.0_151jrelib esources.jar;C:Program FilesJavajdk1.8.0_151jrelib t.jar;D:project2RM arget est-classes;D:project2RM argetclasses;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-webmvc4.3.7.RELEASEspring-webmvc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-expression4.3.7.RELEASEspring-expression-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-web4.3.7.RELEASEspring-web-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-databind2.8.8jackson-databind-2.8.8.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-annotations2.8.0jackson-annotations-2.8.0.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-core2.8.8jackson-core-2.8.8.jar;C:UsersAdministrator.m2 epositoryorghibernatehibernate-validator5.4.1.Finalhibernate-validator-5.4.1.Final.jar;C:UsersAdministrator.m2 epositoryjavaxvalidationvalidation-api1.1.0.Finalvalidation-api-1.1.0.Final.jar;C:UsersAdministrator.m2 epositoryorgjbossloggingjboss-logging3.3.0.Finaljboss-logging-3.3.0.Final.jar;C:UsersAdministrator.m2 epositorycomfasterxmlclassmate1.3.1classmate-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-jdbc4.3.7.RELEASEspring-jdbc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aspects4.3.7.RELEASEspring-aspects-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgaspectjaspectjweaver1.8.9aspectjweaver-1.8.9.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-test4.3.7.RELEASEspring-test-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context-support4.3.7.RELEASEspring-context-support-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context4.3.7.RELEASEspring-context-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-tx4.3.7.RELEASEspring-tx-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-beans4.3.7.RELEASEspring-beans-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycglibcglib-nodep2.1_3cglib-nodep-2.1_3.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aop4.3.7.RELEASEspring-aop-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryaopallianceaopalliance1.0aopalliance-1.0.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-core4.3.7.RELEASEspring-core-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar;C:UsersAdministrator.m2 epositorycommons-collectionscommons-collections3.2.2commons-collections-3.2.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis3.4.2mybatis-3.4.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis-spring1.3.1mybatis-spring-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgmybatisgeneratormybatis-generator-core1.3.5mybatis-generator-core-1.3.5.jar;C:UsersAdministrator.m2 epository kmybatismapper4.1.2mapper-4.1.2.jar;C:UsersAdministrator.m2 epositoryjavaxpersistencepersistence-api1.0persistence-api-1.0.jar;C:UsersAdministrator.m2 epositorycomgithubpagehelperpagehelper5.0.0pagehelper-5.0.0.jar;C:UsersAdministrator.m2 epositorycomgithubjsqlparserjsqlparser .9.5jsqlparser-0.9.5.jar;C:UsersAdministrator.m2 epositoryc3p0c3p0 .9.1.2c3p0-0.9.1.2.jar;C:UsersAdministrator.m2 epositorycommchangemchange-commons-java .2.11mchange-commons-java-0.2.11.jar;C:UsersAdministrator.m2 epositorymysqlmysql-connector-java5.1.38mysql-connector-java-5.1.38.jar;C:UsersAdministrator.m2 epositoryjstljstl1.2jstl-1.2.jar;C:UsersAdministrator.m2 epositoryjavaxservletjavax.servlet-api3.0.1javax.servlet-api-3.0.1.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-simple1.7.25slf4j-simple-1.7.25.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar;C:UsersAdministrator.m2 epositoryjunitjunit4.12junit-4.12.jar;C:UsersAdministrator.m2 epositoryorghamcresthamcrest-core1.3hamcrest-core-1.3.jar;C:UsersAdministrator.m2 epositorydom4jdom4j1.6.1dom4j-1.6.1.jar;C:UsersAdministrator.m2 epositoryxml-apisxml-apis1.0.b2xml-apis-1.0.b2.jar;C:UsersAdministrator.m2 epositoryorgjsoupjsoup1.10.1jsoup-1.10.1.jar;C:UsersAdministrator.m2 epositorycommons-fileuploadcommons-fileupload1.3.3commons-fileupload-1.3.3.jar;C:UsersAdministrator.m2 epositorycommons-iocommons-io2.6commons-io-2.6.jar;C:UsersAdministrator.m2 epositoryorgjsonjson20160810json-20160810.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j .5.0winrm4j-0.5.0.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j-client .5.0winrm4j-client-0.5.0.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http3.1.10cxf-rt-transports-http-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-core3.1.10cxf-core-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxwoodstox-core-asl4.4.1woodstox-core-asl-4.4.1.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxstax2-api3.1.4stax2-api-3.1.4.jar;C:UsersAdministrator.m2 epositoryorgapachewsxmlschemaxmlschema-core2.2.1xmlschema-core-2.2.1.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http-hc3.1.10cxf-rt-transports-http-hc-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgslf4jjcl-over-slf4j1.7.22jcl-over-slf4j-1.7.22.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-jaxws3.1.10cxf-rt-frontend-jaxws-3.1.10.jar;C:UsersAdministrator.m2 epositoryxml-resolverxml-resolver1.2xml-resolver-1.2.jar;C:UsersAdministrator.m2 epositoryorgow2asmasm5.0.4asm-5.0.4.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-soap3.1.10cxf-rt-bindings-soap-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-wsdl3.1.10cxf-rt-wsdl-3.1.10.jar;C:UsersAdministrator.m2 epositorywsdl4jwsdl4j1.6.3wsdl4j-1.6.3.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-databinding-jaxb3.1.10cxf-rt-databinding-jaxb-3.1.10.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-impl2.2.11jaxb-impl-2.2.11.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-core2.2.11jaxb-core-2.2.11.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-xml3.1.10cxf-rt-bindings-xml-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-simple3.1.10cxf-rt-frontend-simple-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-addr3.1.10cxf-rt-ws-addr-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-policy3.1.10cxf-rt-ws-policy-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapache eethi eethi3.0.3 eethi-3.0.3.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore-nio4.4.4httpcore-nio-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore4.4.4httpcore-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpasyncclient4.1.2httpasyncclient-4.1.2.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpclient4.5.2httpclient-4.5.2.jar;C:UsersAdministrator.m2 epositorycommons-codeccommons-codec1.9commons-codec-1.9.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-matchers2.3.0xmlunit-matchers-2.3.0.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-core2.3.0xmlunit-core-2.3.0.jar;C:UsersAdministrator.m2 epositorycomjcraftjsch .1.54jsch-0.1.54.jar;C:UsersAdministrator.m2 epositorylog4jlog4j1.2.17log4j-1.2.17.jar;C:UsersAdministrator.m2 epositoryorgquartz-schedulerquartz2.2.3quartz-2.2.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitextpdf5.4.3itextpdf-5.4.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitext-asian5.2.0itext-asian-5.2.0.jar;C:UsersAdministrator.m2 epositorycomitextpdf oolxmlworker5.4.1xmlworker-5.4.1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 TestExample,test Connected to the target VM, address: '127.0.0.1:7284', transport: 'socket' [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@54c562f7, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@318ba8c8, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6dbb137d, org.springframework.test.context.support.DirtiesContextTestExecutionListener@3c9d0b9d, org.springframework.test.context.transaction.TransactionalTestExecutionListener@43301423, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@2f112965] [main] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [applicationContext.xml] [main] INFO org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@130161f7: startup date [Wed Jan 09 14:40:41 CST 2019]; root of context hierarchy [INFO ] 2019-01-09 14:40:42,692 method:com.mchange.v2.log.MLog.<clinit>(MLog.java:80) MLog clients using log4j logging. [INFO ] 2019-01-09 14:40:42,872 method:com.mchange.v2.c3p0.C3P0Registry.banner(C3P0Registry.java:204) Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10] [main] WARN org.springframework.context.support.GenericApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetParser' defined in file [D:project2RM argetclassesorgkinome mutilsfileAssetParser.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.kinome.rm.utils.file.AssetParser]: Constructor threw exception; nested exception is java.lang.NullPointerException [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@6dbb137d] to prepare test instance [TestExample@23f72d88] java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 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) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetParser' defined in file [D:project2RM argetclassesorgkinome mutilsfileAssetParser.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.kinome.rm.utils.file.AssetParser]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ... 24 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.kinome.rm.utils.file.AssetParser]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ... 40 more Caused by: java.lang.NullPointerException at org.kinome.rm.core.utils.SpringContextUtil.getBean(SpringContextUtil.java:25) at org.kinome.rm.utils.file.AssetParser.<init>(AssetParser.java:33) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ... 42 more java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124) at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 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) Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'assetParser' defined in file [D:project2RM argetclassesorgkinome mutilsfileAssetParser.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.kinome.rm.utils.file.AssetParser]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:128) at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:108) at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:251) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) ... 24 more Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.kinome.rm.utils.file.AssetParser]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ... 40 more Caused by: java.lang.NullPointerException at org.kinome.rm.core.utils.SpringContextUtil.getBean(SpringContextUtil.java:25) at org.kinome.rm.utils.file.AssetParser.<init>(AssetParser.java:33) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ... 42 more Disconnected from the target VM, address: '127.0.0.1:7284', transport: 'socket' Process finished with exit code -1
下面是引入 applicationContext*.xml 时抛出的异常(扫描包配置为不自动配置):
"C:Program FilesJavajdk1.8.0_151injava.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:4279,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:C:UsersAdministrator.IntelliJIdea2018.3systemcaptureAgentdebugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2libidea_rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit-rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit5-rt.jar;C:Program FilesJavajdk1.8.0_151jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_151jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_151jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_151jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_151jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_151jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_151jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_151jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_151jrelibextmysql-connector-java-5.1.28-bin.jar;C:Program FilesJavajdk1.8.0_151jrelibext ashorn.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_151jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_151jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_151jrelibjce.jar;C:Program FilesJavajdk1.8.0_151jrelibjfr.jar;C:Program FilesJavajdk1.8.0_151jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_151jrelibjsse.jar;C:Program FilesJavajdk1.8.0_151jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_151jrelibplugin.jar;C:Program FilesJavajdk1.8.0_151jrelib esources.jar;C:Program FilesJavajdk1.8.0_151jrelib t.jar;D:project2RM arget est-classes;D:project2RM argetclasses;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-webmvc4.3.7.RELEASEspring-webmvc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-expression4.3.7.RELEASEspring-expression-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-web4.3.7.RELEASEspring-web-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-databind2.8.8jackson-databind-2.8.8.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-annotations2.8.0jackson-annotations-2.8.0.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-core2.8.8jackson-core-2.8.8.jar;C:UsersAdministrator.m2 epositoryorghibernatehibernate-validator5.4.1.Finalhibernate-validator-5.4.1.Final.jar;C:UsersAdministrator.m2 epositoryjavaxvalidationvalidation-api1.1.0.Finalvalidation-api-1.1.0.Final.jar;C:UsersAdministrator.m2 epositoryorgjbossloggingjboss-logging3.3.0.Finaljboss-logging-3.3.0.Final.jar;C:UsersAdministrator.m2 epositorycomfasterxmlclassmate1.3.1classmate-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-jdbc4.3.7.RELEASEspring-jdbc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aspects4.3.7.RELEASEspring-aspects-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgaspectjaspectjweaver1.8.9aspectjweaver-1.8.9.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-test4.3.7.RELEASEspring-test-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context-support4.3.7.RELEASEspring-context-support-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context4.3.7.RELEASEspring-context-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-tx4.3.7.RELEASEspring-tx-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-beans4.3.7.RELEASEspring-beans-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycglibcglib-nodep2.1_3cglib-nodep-2.1_3.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aop4.3.7.RELEASEspring-aop-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryaopallianceaopalliance1.0aopalliance-1.0.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-core4.3.7.RELEASEspring-core-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar;C:UsersAdministrator.m2 epositorycommons-collectionscommons-collections3.2.2commons-collections-3.2.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis3.4.2mybatis-3.4.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis-spring1.3.1mybatis-spring-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgmybatisgeneratormybatis-generator-core1.3.5mybatis-generator-core-1.3.5.jar;C:UsersAdministrator.m2 epository kmybatismapper4.1.2mapper-4.1.2.jar;C:UsersAdministrator.m2 epositoryjavaxpersistencepersistence-api1.0persistence-api-1.0.jar;C:UsersAdministrator.m2 epositorycomgithubpagehelperpagehelper5.0.0pagehelper-5.0.0.jar;C:UsersAdministrator.m2 epositorycomgithubjsqlparserjsqlparser .9.5jsqlparser-0.9.5.jar;C:UsersAdministrator.m2 epositoryc3p0c3p0 .9.1.2c3p0-0.9.1.2.jar;C:UsersAdministrator.m2 epositorycommchangemchange-commons-java .2.11mchange-commons-java-0.2.11.jar;C:UsersAdministrator.m2 epositorymysqlmysql-connector-java5.1.38mysql-connector-java-5.1.38.jar;C:UsersAdministrator.m2 epositoryjstljstl1.2jstl-1.2.jar;C:UsersAdministrator.m2 epositoryjavaxservletjavax.servlet-api3.0.1javax.servlet-api-3.0.1.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-simple1.7.25slf4j-simple-1.7.25.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar;C:UsersAdministrator.m2 epositoryjunitjunit4.12junit-4.12.jar;C:UsersAdministrator.m2 epositoryorghamcresthamcrest-core1.3hamcrest-core-1.3.jar;C:UsersAdministrator.m2 epositorydom4jdom4j1.6.1dom4j-1.6.1.jar;C:UsersAdministrator.m2 epositoryxml-apisxml-apis1.0.b2xml-apis-1.0.b2.jar;C:UsersAdministrator.m2 epositoryorgjsoupjsoup1.10.1jsoup-1.10.1.jar;C:UsersAdministrator.m2 epositorycommons-fileuploadcommons-fileupload1.3.3commons-fileupload-1.3.3.jar;C:UsersAdministrator.m2 epositorycommons-iocommons-io2.6commons-io-2.6.jar;C:UsersAdministrator.m2 epositoryorgjsonjson20160810json-20160810.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j .5.0winrm4j-0.5.0.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j-client .5.0winrm4j-client-0.5.0.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http3.1.10cxf-rt-transports-http-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-core3.1.10cxf-core-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxwoodstox-core-asl4.4.1woodstox-core-asl-4.4.1.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxstax2-api3.1.4stax2-api-3.1.4.jar;C:UsersAdministrator.m2 epositoryorgapachewsxmlschemaxmlschema-core2.2.1xmlschema-core-2.2.1.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http-hc3.1.10cxf-rt-transports-http-hc-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgslf4jjcl-over-slf4j1.7.22jcl-over-slf4j-1.7.22.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-jaxws3.1.10cxf-rt-frontend-jaxws-3.1.10.jar;C:UsersAdministrator.m2 epositoryxml-resolverxml-resolver1.2xml-resolver-1.2.jar;C:UsersAdministrator.m2 epositoryorgow2asmasm5.0.4asm-5.0.4.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-soap3.1.10cxf-rt-bindings-soap-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-wsdl3.1.10cxf-rt-wsdl-3.1.10.jar;C:UsersAdministrator.m2 epositorywsdl4jwsdl4j1.6.3wsdl4j-1.6.3.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-databinding-jaxb3.1.10cxf-rt-databinding-jaxb-3.1.10.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-impl2.2.11jaxb-impl-2.2.11.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-core2.2.11jaxb-core-2.2.11.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-xml3.1.10cxf-rt-bindings-xml-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-simple3.1.10cxf-rt-frontend-simple-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-addr3.1.10cxf-rt-ws-addr-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-policy3.1.10cxf-rt-ws-policy-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapache eethi eethi3.0.3 eethi-3.0.3.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore-nio4.4.4httpcore-nio-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore4.4.4httpcore-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpasyncclient4.1.2httpasyncclient-4.1.2.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpclient4.5.2httpclient-4.5.2.jar;C:UsersAdministrator.m2 epositorycommons-codeccommons-codec1.9commons-codec-1.9.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-matchers2.3.0xmlunit-matchers-2.3.0.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-core2.3.0xmlunit-core-2.3.0.jar;C:UsersAdministrator.m2 epositorycomjcraftjsch .1.54jsch-0.1.54.jar;C:UsersAdministrator.m2 epositorylog4jlog4j1.2.17log4j-1.2.17.jar;C:UsersAdministrator.m2 epositoryorgquartz-schedulerquartz2.2.3quartz-2.2.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitextpdf5.4.3itextpdf-5.4.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitext-asian5.2.0itext-asian-5.2.0.jar;C:UsersAdministrator.m2 epositorycomitextpdf oolxmlworker5.4.1xmlworker-5.4.1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 @w@C:UsersAdministratorAppDataLocalTempidea_working_dirs_junit.tmp @C:UsersAdministratorAppDataLocalTempidea_junit.tmp Connected to the target VM, address: '127.0.0.1:4279', transport: 'socket' [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@27ae2fd0, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@29176cc1, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2f177a4b, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4278a03f, org.springframework.test.context.transaction.TransactionalTestExecutionListener@147ed70f, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@61dd025] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TestExample': Unsatisfied dependency expressed through field 'assetsDevicetypeRefactorMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:386) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 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) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1486) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 35 more [main] INFO org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@2ef3eef9: startup date [Wed Jan 09 15:45:26 CST 2019]; root of context hierarchy [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2f177a4b] to prepare test instance [TestExample@130c12b7] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TestExample': Unsatisfied dependency expressed through field 'assetsDevicetypeRefactorMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:386) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 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) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1486) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 35 more [Thread-0] INFO org.springframework.context.support.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@2ef3eef9: startup date [Wed Jan 09 15:45:26 CST 2019]; root of context hierarchy Disconnected from the target VM, address: '127.0.0.1:4279', transport: 'socket' Process finished with exit code -1
下面是引入 applicationContext*.xml ,扫描包已经改为自动配置的异常:
"C:Program FilesJavajdk1.8.0_151injava.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:4033,suspend=y,server=n -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:C:UsersAdministrator.IntelliJIdea2018.3systemcaptureAgentdebugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2libidea_rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit-rt.jar;C:Program FilesJetBrainsIntelliJ IDEA 2018.3.2pluginsjunitlibjunit5-rt.jar;C:Program FilesJavajdk1.8.0_151jrelibcharsets.jar;C:Program FilesJavajdk1.8.0_151jrelibdeploy.jar;C:Program FilesJavajdk1.8.0_151jrelibextaccess-bridge-64.jar;C:Program FilesJavajdk1.8.0_151jrelibextcldrdata.jar;C:Program FilesJavajdk1.8.0_151jrelibextdnsns.jar;C:Program FilesJavajdk1.8.0_151jrelibextjaccess.jar;C:Program FilesJavajdk1.8.0_151jrelibextjfxrt.jar;C:Program FilesJavajdk1.8.0_151jrelibextlocaledata.jar;C:Program FilesJavajdk1.8.0_151jrelibextmysql-connector-java-5.1.28-bin.jar;C:Program FilesJavajdk1.8.0_151jrelibext ashorn.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunec.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunjce_provider.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunmscapi.jar;C:Program FilesJavajdk1.8.0_151jrelibextsunpkcs11.jar;C:Program FilesJavajdk1.8.0_151jrelibextzipfs.jar;C:Program FilesJavajdk1.8.0_151jrelibjavaws.jar;C:Program FilesJavajdk1.8.0_151jrelibjce.jar;C:Program FilesJavajdk1.8.0_151jrelibjfr.jar;C:Program FilesJavajdk1.8.0_151jrelibjfxswt.jar;C:Program FilesJavajdk1.8.0_151jrelibjsse.jar;C:Program FilesJavajdk1.8.0_151jrelibmanagement-agent.jar;C:Program FilesJavajdk1.8.0_151jrelibplugin.jar;C:Program FilesJavajdk1.8.0_151jrelib esources.jar;C:Program FilesJavajdk1.8.0_151jrelib t.jar;D:project2RM arget est-classes;D:project2RM argetclasses;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-webmvc4.3.7.RELEASEspring-webmvc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-expression4.3.7.RELEASEspring-expression-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-web4.3.7.RELEASEspring-web-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-databind2.8.8jackson-databind-2.8.8.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-annotations2.8.0jackson-annotations-2.8.0.jar;C:UsersAdministrator.m2 epositorycomfasterxmljacksoncorejackson-core2.8.8jackson-core-2.8.8.jar;C:UsersAdministrator.m2 epositoryorghibernatehibernate-validator5.4.1.Finalhibernate-validator-5.4.1.Final.jar;C:UsersAdministrator.m2 epositoryjavaxvalidationvalidation-api1.1.0.Finalvalidation-api-1.1.0.Final.jar;C:UsersAdministrator.m2 epositoryorgjbossloggingjboss-logging3.3.0.Finaljboss-logging-3.3.0.Final.jar;C:UsersAdministrator.m2 epositorycomfasterxmlclassmate1.3.1classmate-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-jdbc4.3.7.RELEASEspring-jdbc-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aspects4.3.7.RELEASEspring-aspects-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgaspectjaspectjweaver1.8.9aspectjweaver-1.8.9.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-test4.3.7.RELEASEspring-test-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context-support4.3.7.RELEASEspring-context-support-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-context4.3.7.RELEASEspring-context-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-tx4.3.7.RELEASEspring-tx-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-beans4.3.7.RELEASEspring-beans-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycglibcglib-nodep2.1_3cglib-nodep-2.1_3.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-aop4.3.7.RELEASEspring-aop-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositoryaopallianceaopalliance1.0aopalliance-1.0.jar;C:UsersAdministrator.m2 epositoryorgspringframeworkspring-core4.3.7.RELEASEspring-core-4.3.7.RELEASE.jar;C:UsersAdministrator.m2 epositorycommons-loggingcommons-logging1.2commons-logging-1.2.jar;C:UsersAdministrator.m2 epositorycommons-collectionscommons-collections3.2.2commons-collections-3.2.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis3.4.2mybatis-3.4.2.jar;C:UsersAdministrator.m2 epositoryorgmybatismybatis-spring1.3.1mybatis-spring-1.3.1.jar;C:UsersAdministrator.m2 epositoryorgmybatisgeneratormybatis-generator-core1.3.5mybatis-generator-core-1.3.5.jar;C:UsersAdministrator.m2 epository kmybatismapper4.1.2mapper-4.1.2.jar;C:UsersAdministrator.m2 epositoryjavaxpersistencepersistence-api1.0persistence-api-1.0.jar;C:UsersAdministrator.m2 epositorycomgithubpagehelperpagehelper5.0.0pagehelper-5.0.0.jar;C:UsersAdministrator.m2 epositorycomgithubjsqlparserjsqlparser .9.5jsqlparser-0.9.5.jar;C:UsersAdministrator.m2 epositoryc3p0c3p0 .9.1.2c3p0-0.9.1.2.jar;C:UsersAdministrator.m2 epositorycommchangemchange-commons-java .2.11mchange-commons-java-0.2.11.jar;C:UsersAdministrator.m2 epositorymysqlmysql-connector-java5.1.38mysql-connector-java-5.1.38.jar;C:UsersAdministrator.m2 epositoryjstljstl1.2jstl-1.2.jar;C:UsersAdministrator.m2 epositoryjavaxservletjavax.servlet-api3.0.1javax.servlet-api-3.0.1.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-simple1.7.25slf4j-simple-1.7.25.jar;C:UsersAdministrator.m2 epositoryorgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar;C:UsersAdministrator.m2 epositoryjunitjunit4.12junit-4.12.jar;C:UsersAdministrator.m2 epositoryorghamcresthamcrest-core1.3hamcrest-core-1.3.jar;C:UsersAdministrator.m2 epositorydom4jdom4j1.6.1dom4j-1.6.1.jar;C:UsersAdministrator.m2 epositoryxml-apisxml-apis1.0.b2xml-apis-1.0.b2.jar;C:UsersAdministrator.m2 epositoryorgjsoupjsoup1.10.1jsoup-1.10.1.jar;C:UsersAdministrator.m2 epositorycommons-fileuploadcommons-fileupload1.3.3commons-fileupload-1.3.3.jar;C:UsersAdministrator.m2 epositorycommons-iocommons-io2.6commons-io-2.6.jar;C:UsersAdministrator.m2 epositoryorgjsonjson20160810json-20160810.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j .5.0winrm4j-0.5.0.jar;C:UsersAdministrator.m2 epositoryiocloudsoftwindowswinrm4j-client .5.0winrm4j-client-0.5.0.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http3.1.10cxf-rt-transports-http-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-core3.1.10cxf-core-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxwoodstox-core-asl4.4.1woodstox-core-asl-4.4.1.jar;C:UsersAdministrator.m2 epositoryorgcodehauswoodstoxstax2-api3.1.4stax2-api-3.1.4.jar;C:UsersAdministrator.m2 epositoryorgapachewsxmlschemaxmlschema-core2.2.1xmlschema-core-2.2.1.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-transports-http-hc3.1.10cxf-rt-transports-http-hc-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgslf4jjcl-over-slf4j1.7.22jcl-over-slf4j-1.7.22.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-jaxws3.1.10cxf-rt-frontend-jaxws-3.1.10.jar;C:UsersAdministrator.m2 epositoryxml-resolverxml-resolver1.2xml-resolver-1.2.jar;C:UsersAdministrator.m2 epositoryorgow2asmasm5.0.4asm-5.0.4.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-soap3.1.10cxf-rt-bindings-soap-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-wsdl3.1.10cxf-rt-wsdl-3.1.10.jar;C:UsersAdministrator.m2 epositorywsdl4jwsdl4j1.6.3wsdl4j-1.6.3.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-databinding-jaxb3.1.10cxf-rt-databinding-jaxb-3.1.10.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-impl2.2.11jaxb-impl-2.2.11.jar;C:UsersAdministrator.m2 epositorycomsunxmlindjaxb-core2.2.11jaxb-core-2.2.11.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-bindings-xml3.1.10cxf-rt-bindings-xml-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-frontend-simple3.1.10cxf-rt-frontend-simple-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-addr3.1.10cxf-rt-ws-addr-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapachecxfcxf-rt-ws-policy3.1.10cxf-rt-ws-policy-3.1.10.jar;C:UsersAdministrator.m2 epositoryorgapache eethi eethi3.0.3 eethi-3.0.3.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore-nio4.4.4httpcore-nio-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpcore4.4.4httpcore-4.4.4.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpasyncclient4.1.2httpasyncclient-4.1.2.jar;C:UsersAdministrator.m2 epositoryorgapachehttpcomponentshttpclient4.5.2httpclient-4.5.2.jar;C:UsersAdministrator.m2 epositorycommons-codeccommons-codec1.9commons-codec-1.9.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-matchers2.3.0xmlunit-matchers-2.3.0.jar;C:UsersAdministrator.m2 epositoryorgxmlunitxmlunit-core2.3.0xmlunit-core-2.3.0.jar;C:UsersAdministrator.m2 epositorycomjcraftjsch .1.54jsch-0.1.54.jar;C:UsersAdministrator.m2 epositorylog4jlog4j1.2.17log4j-1.2.17.jar;C:UsersAdministrator.m2 epositoryorgquartz-schedulerquartz2.2.3quartz-2.2.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitextpdf5.4.3itextpdf-5.4.3.jar;C:UsersAdministrator.m2 epositorycomitextpdfitext-asian5.2.0itext-asian-5.2.0.jar;C:UsersAdministrator.m2 epositorycomitextpdf oolxmlworker5.4.1xmlworker-5.4.1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 @w@C:UsersAdministratorAppDataLocalTempidea_working_dirs_junit.tmp @C:UsersAdministratorAppDataLocalTempidea_junit.tmp Connected to the target VM, address: '127.0.0.1:4033', transport: 'socket' [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] [main] INFO org.springframework.test.context.support.DefaultTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@27ae2fd0, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@29176cc1, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2f177a4b, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4278a03f, org.springframework.test.context.transaction.TransactionalTestExecutionListener@147ed70f, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@61dd025] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TestExample': Unsatisfied dependency expressed through field 'assetsDevicetypeRefactorMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:386) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 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) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1486) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 35 more [main] INFO org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@2ef3eef9: startup date [Wed Jan 09 15:43:06 CST 2019]; root of context hierarchy [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@2f177a4b] to prepare test instance [TestExample@130c12b7] org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'TestExample': Unsatisfied dependency expressed through field 'assetsDevicetypeRefactorMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:386) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:118) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:230) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:228) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:287) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:289) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:247) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 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) Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.kinome.rm.dao.AssetsDevicetypeRefactorMapper' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1486) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1104) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ... 35 more [Thread-0] INFO org.springframework.context.support.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@2ef3eef9: startup date [Wed Jan 09 15:43:06 CST 2019]; root of context hierarchy Disconnected from the target VM, address: '127.0.0.1:4033', transport: 'socket' Process finished with exit code -1