为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

烙印99 2019-05-15 10:33:34
springboot项目,想要集成tk.mybatis框架。使用的spring的快速配置:pom.xmltk.mybatismapper-spring-boot-starter1.2.0application.ymlmapper:not-empty:falseidentity:MYSQLmappers:-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]求大佬帮助!
查看完整描述

2 回答

?
一只甜甜圈

TA贡献1836条经验 获得超5个赞

替换版本后可以了。1.2.3pom.xmltk.mybatismapper-spring-boot-starter1.2.3低版本是用下面注解也可以@tk.mybatis.spring.annotation.MapperScan
查看完整回答
反对 回复 2019-05-15
  • 2 回答
  • 0 关注
  • 307 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信