我試圖在我的春天項目中使用mybatis,但我想知道一件事情:是applicationContext需要任何配置來讀取mybatis.xml?春天未能轉換mybatis配置
這裏是我的xml:
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="typeAliasesPackage" value="com.Ordering.Model" />
<property name="mapperLocations" value="classpath:mapper/*.xml" />
</bean>
如果我添加此配置:
<property name="configuration" value="classpath:mybatis/mybatis-config.xml" />
我會得到這個消息:
Failed to convert property value of type 'java.lang.String' to required type 'org.apache.ibatis.session.Configuration'
當我刪除它,沒有什麼錯誤。我需要任何配置來轉換mybatis.xml。
感謝。我使用'configLocation'而不是'configuration'並且它工作。 –