dataSource提示如图,运行AreaDaoTest错误。求救~~

来源:13-4 dao的迁移上

vvshyer

2017-11-01

http://img.mukewang.com/szimg/59f91bb70001b8dd15941918.jpg

运行AreaDaoTest错误:


 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@14bf9759 - Registering current configuration as safe fallback point


2017-11-01 08:57:23.323 [%PARSER_ERROR[thead]] INFO  o.s.b.t.context.SpringBootTestContextBootstrapper -Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.sun.o2o.dao.AreaDaoTest], using SpringBootContextLoader

2017-11-01 08:57:23.329 [%PARSER_ERROR[thead]] INFO  o.s.test.context.support.AbstractContextLoader -Could not detect default resource locations for test class [com.sun.o2o.dao.AreaDaoTest]: no resource found for suffixes {-context.xml, Context.groovy}.

2017-11-01 08:57:23.330 [%PARSER_ERROR[thead]] INFO  o.s.t.c.support.AnnotationConfigContextLoaderUtils -Could not detect default configuration classes for test class [com.sun.o2o.dao.AreaDaoTest]: AreaDaoTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

2017-11-01 08:57:23.486 [%PARSER_ERROR[thead]] INFO  o.s.b.t.context.SpringBootTestContextBootstrapper -Found @SpringBootConfiguration com.sun.o2o.O2oApplication for test class com.sun.o2o.dao.AreaDaoTest

2017-11-01 08:57:23.499 [%PARSER_ERROR[thead]] INFO  o.s.b.t.context.SpringBootTestContextBootstrapper -Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, 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]

2017-11-01 08:57:23.528 [%PARSER_ERROR[thead]] INFO  o.s.b.t.context.SpringBootTestContextBootstrapper -Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@2b6faea6, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@778d1062, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@670002, org.springframework.test.context.support.DirtiesContextTestExecutionListener@1f0f1111, org.springframework.test.context.transaction.TransactionalTestExecutionListener@49c386c8, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@56528192, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@6e0dec4a, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@96def03, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@5ccddd20, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@1ed1993a, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@1f3f4916, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@794cb805]2017-11-01 08:57:33.965 [%PARSER_ERROR[thead]] ERROR org.springframework.boot.SpringApplication -Application startup failed

java.lang.IllegalStateException: Logback configuration error detected: 

ERROR in ch.qos.logback.core.pattern.parser.Compiler@7ea9e1e2 - There is no conversion class registered for conversion word [thead]

ERROR in ch.qos.logback.core.pattern.parser.Compiler@7ea9e1e2 - [thead] is not a valid conversion word

ERROR in ch.qos.logback.core.pattern.parser.Compiler@24fcf36f - There is no conversion class registered for conversion word [thead]

ERROR in ch.qos.logback.core.pattern.parser.Compiler@24fcf36f - [thead] is not a valid conversion word

ERROR in ch.qos.logback.core.pattern.parser.Compiler@10feca44 - There is no conversion class registered for conversion word [thead]

ERROR in ch.qos.logback.core.pattern.parser.Compiler@10feca44 - [thead] is not a valid conversion word

ERROR in ch.qos.logback.core.pattern.parser.Compiler@3fb1549b - There is no conversion class registered for conversion word [thead]

ERROR in ch.qos.logback.core.pattern.parser.Compiler@3fb1549b - [thead] is not a valid conversion word



2017-11-01 08:57:33.966 [%PARSER_ERROR[thead]] ERROR o.springframework.test.context.TestContextManager -Caught exception while allowing TestExecutionListener [org.springframework.test.context.web.ServletTestExecutionListener@2b6faea6] to prepare test instance [com.sun.o2o.dao.AreaDaoTest@10d307f1]

java.lang.IllegalStateException: Failed to load ApplicationContext


写回答

1回答

翔仔

2017-11-01

同学看错误貌似还是和配置相关,请确认退回单库再进行配置,这里显示有重复的dataSource注入到了容器里面 IOC不认得是用哪个了。同时感觉配置错误的地方还有一些,请留意这个错误

Could not detect default configuration classes for test class [com.sun.o2o.dao.AreaDaoTest]: AreaDaoTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.

基本就是You can’t use both XML context file and @Configuration annotated classes.

感觉同学使用了XML以及代码两种配置,请确认跟着视频走,springboot了之后除了pom.xml mybatis-config.xml还有mapper之外其他的xml都不要迁移过来了呢 

0
3
vvshyer
回复
翔仔
嗯 移除了就好使了 测试就能通过了
2017-11-01
共3条回复

Java双版本(SSM到SpringBoot)校园商铺全栈开发

SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需

5113 学习 · 8144 问题

查看课程