bug审核 03 Spring整合MyBatis报错 Error creating bean with name ‘sqlsessionFactory‘

背景:

Spring整合MyBatis时其他配置都没问题,排查了几遍,都是报错:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlsessionFactory' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException

 

由于是 sqlsessionFactory 的问题,所以应该是mapper文件或者是对应的接口文件或者JavaDAO程序的bean有问题,经过排查,将applicationContext.xml文件中相关bean内容都依次注释后,发现问题出在 sqlsessionFactory 的bean中,查看里面的配置也没有问题。


	    
	    
		

由于以上的配置,相关的代码都没有问题,但是又始终报错,所以需要排查其他问题。偶然间发现在lib的引入中,MyBatis的jar包居然引入了两个,并都进行了buildPath。

bug审核 03 Spring整合MyBatis报错 Error creating bean with name ‘sqlsessionFactory‘_第1张图片

 remove掉 3.0.1版本的jar包,运行正常了。

你可能感兴趣的:(bug排查,mybatis,spring,bug)