Spring+mybatis+SpringMVC整合发生异常:org.springframework.beans.ConversionNotSupportedException

来源:互联网 发布:中老年春秋连衣裙淘宝 编辑:程序博客网 时间:2024/05/01 05:23

错误:

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


原因:

<property name="sqlSessionFactoryBeanName" ref="sqlSessionFactoryBean"/>


解决:

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<!-- 会话工厂 -->
<property name="sqlSessionFactoryBeanName"
 value="sqlSessionFactoryBean"/>

将property中ref修改为了value,正确的写法应该是使用value属性!

2
阅读全文
0 0
原创粉丝点击