问题
I tried mybatis-spring 1.2.2 with mybatis 3.2.5 and Spring version 4.1.0.Release and it appears like it is not supported.
mybatis-spring 1.2.2 spring contains org.springframework.core.MethodParameter
class however, getContainingClass()
is not present.
I am getting the exception:
java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getContainingClass()
Any idea is I could use Mybatis with Spring 4x at all? (even ibatis seems to be unsupported)
回答1:
Looking in the pom.xml
of the Spring MyBatis here I can see that the project itself depends on Spring 3.2.9:
...
<spring.version>3.2.9.RELEASE</spring.version>
...
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
So, based on that I wouldn't be surprised if I would get an exception like the one you are getting in my project and I would have to say that "no", it's not supported.
回答2:
We are using MyBatis v3.2.7 with Spring v4.0.6 and so far we have not seen any issues. Since Spring usually maintains the backward compatibility, it usually works.
However, I am not sure (as of this writing) if it is totally supported in Spring v4.1.x.
来源:https://stackoverflow.com/questions/25047736/is-mybatis-supported-with-spring-4-x