spring与mybatis整合出现下面的错误
Spring配置文件:<!--配置数据源--><beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSo...
Spring配置文件:
<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/class" />
<property name="username" value="root" />
<property name="password" value="ok" />
</bean>
<!-- 配置SqlsessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<!-- 装配数据源 -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置要扫描的实体类的映射文件.xml -->
<property name="mapperLocations" value="classpath:cn/jbit/classes/entity/*.xml"/>
<!-- 指定 定义别名 的实体类 -->
<property name="typeAliasesPackage" value="cn.jbit.classes.entity"/>
</bean>
<bean id="StudentDao" class="cn.jbit.classes.dao.impl.StudentDaoImpl" >
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean> 展开
<!-- 配置数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/class" />
<property name="username" value="root" />
<property name="password" value="ok" />
</bean>
<!-- 配置SqlsessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="classpath:mybatis-config.xml"/>
<!-- 装配数据源 -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置要扫描的实体类的映射文件.xml -->
<property name="mapperLocations" value="classpath:cn/jbit/classes/entity/*.xml"/>
<!-- 指定 定义别名 的实体类 -->
<property name="typeAliasesPackage" value="cn.jbit.classes.entity"/>
</bean>
<bean id="StudentDao" class="cn.jbit.classes.dao.impl.StudentDaoImpl" >
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询