小杰68 2015-09-22 05:41 采纳率: 0%
浏览 2682
已结题

spring配置多数据源t junit测试报错

Error creating bean with name 'seentao.workflow.engine.EngineTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests.setDataSource(javax.sql.DataSource); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.sql.DataSource] is defined: expected single matching bean but found 3: [mysql, mysqlTo, dynamicDatasource]

报错信息的意识是,spring配置了[mysql, mysqlTo, dynamicDatasource]3个数据源,测试时不知道使用哪一个,请教如何配置junit才能不报错。

  • 写回答

1条回答 默认 最新

  • 微甜灬呼吸 2015-09-22 09:44
    关注

    注解时byName 不要byType

    评论

报告相同问题?