org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'use
今天用SpringMVC整合mybatis做了一个简单的前端项目,jetty:run之后出现这个报错,导致了自己浪费了很多时间来排除这个错误。
错误代码如下图:
首先我排除是否是编码的错误
第一步将数据库的配置文件的格式改为utf-8,但是结果还是没有效果;
!!!!!!!!!!!
最后经过两次的排错,一定是SpringMVC的配置文件有错误!应该是某个细节写错了
我就是把mapperLocations少写了个s导致我看到一堆报错而没有想法去改变去认真
的分析这个错误。
<!--整合mybatis -->
<bean class="org.mybatis.spring.SqlSessionFactoryBean" >
<property name="dataSource" ref="dataSource"></property>
<property name="mapperLocations" value="classpath:mappers/*.xml"></property>
<property name="typeAliasesPackage" value="com.etoak.bean"></property>
<property name="plugins">
<array>
<bean class="com.github.pagehelper.PageInterceptor">
<property name="properties">
<props>
<prop key="reasonable">true</prop>
</props>
</property>
</bean>
</array>
</property>
</bean>