Spring和mybatis整合时报出的错误

来源:互联网 发布:iface102下载数据 编辑:程序博客网 时间:2024/05/20 19:47

错误:

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.ibatis.session.defaults.DefaultSqlSessionFactory' to required type 'java.lang.String' for property 'sqlSessionFactoryBeanName'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.ibatis.session.defaults.DefaultSqlSessionFactory] to required type [java.lang.String] for property 'sqlSessionFactoryBeanName': no matching editors or conversion strategy found


出现错误的原因:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 会话工厂 -->
<property name="sqlSessionFactoryBeanName"
value="sqlSessionFactoryBean"/>

上面property中value修改为了ref,就会报出错误,正确的写法应该是使用value属性

0 0
原创粉丝点击