今天用idea整合maven工程时,出现了No qualifying bean of type [org.apache.ibatis.session.SqlSessionFactory] is defined:No unique bean of type [org.apache.ibatis.sessioin.SqlSessionFactory] is defined:expected single matching bean but found 2:[sqlSessionFactoryBean1,sqlSessionFactoryBean2] 错误,大概是有两个SqlSessionFactoryBean对象。其原因是
applicationConext-dao.xml文件里已经定义了一个dataSource数据源。但是在事务配置文件applicationContext-trans中引用这个会报错。于是加了一个
![](https://i-blog.csdnimg.cn/blog_migrate/0e60f277468c7ff6610d12c97eaf3c18.png)
![](https://i-blog.csdnimg.cn/blog_migrate/fcc433638958b3103305197cc0bb2399.png)
![](https://i-blog.csdnimg.cn/blog_migrate/1cd09038b3c39d98764e5903603c7234.png)
最后删掉上面的import即可不报错。