運行testGetSeckillList這個測試方法的時候報這個錯
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring/spring-dao.xml]: Invocation of init method failed; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. ?Cause: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 29; 文檔根元素 "configuration" 必須匹配 DOCTYPE 根 "null"。
2016-06-29
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
? ? ? xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
? ? ? xmlns:context="http://www.springframework.org/schema/context"
? ? ? xsi:schemaLocation="
? ? ? http://www.springframework.org/schema/beans
? ? ? http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
? ? ? http://www.springframework.org/schema/context
? ? ? http://www.springframework.org/schema/context/spring-context-3.0.xsd"
? ? ? default-lazy-init="false">
? <!--配置整合mybatis過程-->
? ?<!--1:配置數據庫相關參數properties的屬性: ${url}-->
? <context:property-placeholder location="classpath:jdbc.properties"/>
? <!--2:數據庫連接池-->
? <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
? ? ?<!-- 配置連接池屬性-->
? ? ?<property name="driverClass" value="${driver}"/>
? ? ?<property name="jdbcUrl" value="${url}"/>
? ? ?<property name="user" value="${username}"/>
? ? ?<property name="password" value="${password}"/>
? ? ?<!-- c3p0連接池的私有屬性 -->
? ? ?<property name="maxPoolSize" value="30"/>
? ? ?<property name="minPoolSize" value="10"/>
? ? ?<!--關閉連接后不自動commit-->
? ? ?<property name="autoCommitOnClose" value="false"/>
? ? ?<!--獲取連接超時時間-->
? ? ?<property name="checkoutTimeout" value="1000"/>
? ? ?<!--獲取連接失敗重試次數-->
? ? ?<property name="acquireRetryAttempts" value="2"/>
? </bean>
? <!--約定大于配置-->
? <!--3:配置SqlSessionFactory對象-->
? <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
? ? ?<!--注入數據庫連接池-->
? ? ?<property name="dataSource" ref="dataSource"/>
? ? ?<!-- 配置MyBatis全局配置文件:mybatis-config.xml-->
? ? ?<property name="configLocation" value="classpath:mybatis-config.xml"/>
? ? ?<!--掃描entity包 使用別名 org.seckill.entity.Seckill Seckill-->
? ? ?<property name="typeAliasesPackage" value="org.seckill.entity"/>
? ? ?<!--掃描sql配置文件:mapper需要的xml文件-->
? ? ?<property name="mapperLocations" value="classpath:mapper/*.xml"/>
? </bean>
? <!-- 4:配置掃描Dao接口包 動態實現Dao接口 注入到spring容器中-->
? <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
? ? ?<!-- 注入sqlSessionFactory-->
? ? ?<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
? ? ?<!--給出需要掃描Dao接口包-->
? ? ?<property name="basePackage" value="org.seckill.dao"/>
? </bean>
</beans>
2016-06-28
沒有找到 對應的bean ?看文件xml 配置