java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for cn.lq.da

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ilikejj0/article/details/82706866

java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for cn.lq.dao.DictionaryMapper.selectDictionaryByType

出现这个异常时因为在sqlMapConfig.xml中没有将DictionaryMapper.xml配置进去,当在这里指定mapper的配置时,会出现无法解析resource="mapper/*.xml",我是使用mapper动态代理来实现的,所以在配置sqlSessionFactory的时候指定.

<mappers>
       <mapper resource="mapper/*.xml"/>
   </mappers> -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="configLocation" value="classpath:mybatis/sqlMapConfig.xml" />
        <!-- 指定mybatis,mapper文件的位置 -->
        <property name="mapperLocations" value="classpath:mapper/*.xml"></property>

    </bean>

其实也搞不太懂是不是这个的原因,因为当时改动了很多,暂时没有时间去深究,先记录下这个错误,以及可能解决的办法。

猜你喜欢

转载自blog.csdn.net/ilikejj0/article/details/82706866