报错Caused by: org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.util.InvalidPropertiesFormatException:
org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 246; 文档根元素 "beans" 必须匹配 DOCTYPE 根 "null"。
可以看出来是重复了bean
因为在applicationContext.xml中引入了MyBatis-Config.xml文件,使用的是
<!--引入mybatis相关的-->
<context:property-placeholder location="MyBatis-config.xml"/>
还一直不知道为啥dataSource会报错
正确的应该是使用import,而不是context:property-placeholder来引入
正确如下:
<!--引入mybatis相关的-->
<import resource="classpath:MyBatis-config.xml"/>