猿问

spring boot 集成 tk.mybatis 报错,反射方法异常

springboot项目,想要集成tk.mybatis框架。
使用的spring的快速配置:
pom.xml
tk.mybatis
mapper-spring-boot-starter
1.2.0
application.yml
mapper:
not-empty:false
identity:MYSQL
mappers:
-online.yuyanjia.template.mobile.util.BaseMapper
其他的地方没有做配置,测试的时候报错
java.lang.NoSuchMethodException:tk.mybatis.mapper.provider.base.BaseSelectProvider.()
atjava.lang.Class.getConstructor0(Class.java:3082)~[?:1.8.0_40]
atjava.lang.Class.newInstance(Class.java:412)~[?:1.8.0_40]
atorg.apache.ibatis.builder.annotation.ProviderSqlSource.createSqlSource(ProviderSqlSource.java:117)~[mybatis-3.4.5.jar:3.4.5]
atorg.apache.ibatis.builder.annotation.ProviderSqlSource.getBoundSql(ProviderSqlSource.java:103)~[mybatis-3.4.5.jar:3.4.5]
atorg.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:292)~[mybatis-3.4.5.jar:3.4.5]
atcom.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:83)~[pagehelper-5.1.2.jar:?]
atorg.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)~[mybatis-3.4.5.jar:3.4.5]
atcom.sun.proxy.$Proxy103.query(UnknownSource)~[?:?]
atorg.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)~[mybatis-3.4.5.jar:3.4.5]
atorg.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)~[mybatis-3.4.5.jar:3.4.5]
atorg.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:77)~[mybatis-3.4.5.jar:3.4.5]
atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)~[?:1.8.0_40]
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)~[?:1.8.0_40]
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[?:1.8.0_40]
atjava.lang.reflect.Method.invoke(Method.java:497)~[?:1.8.0_40]
atorg.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)~[mybatis-spring-1.3.1.jar:1.3.1]
atcom.sun.proxy.$Proxy86.selectOne(UnknownSource)~[?:?]
atorg.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:166)~[mybatis-spring-1.3.1.jar:1.3.1]
atorg.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:82)~[mybatis-3.4.5.jar:3.4.5]
atorg.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)~[mybatis-3.4.5.jar:3.4.5]
atcom.sun.proxy.$Proxy87.selectByPrimaryKey(UnknownSource)~[?:?]
atonline.yuyanjia.template.mobile.controller.TestController.test(TestController.java:27)~[classes/:?]
atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)~[?:1.8.0_40]
atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)~[?:1.8.0_40]
atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)~[?:1.8.0_40]
atjava.lang.reflect.Method.invoke(Method.java:497)~[?:1.8.0_40]
atorg.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:635)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)~[spring-webmvc-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:742)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)~[tomcat-embed-websocket-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:108)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)~[spring-web-4.3.13.RELEASE.jar:4.3.13.RELEASE]
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)~[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)[tomcat-embed-core-8.5.23.jar:8.5.23]
atorg.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)[tomcat-embed-core-8.5.23.jar:8.5.23]
atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[?:1.8.0_40]
atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[?:1.8.0_40]
atorg.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)[tomcat-embed-core-8.5.23.jar:8.5.23]
atjava.lang.Thread.run(Thread.java:745)[?:1.8.0_40]
求大佬帮助!
烙印99
浏览 308回答 2
2回答

一只甜甜圈

替换版本后可以了。1.2.3pom.xmltk.mybatismapper-spring-boot-starter1.2.3低版本是用下面注解也可以@tk.mybatis.spring.annotation.MapperScan
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答