java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseSelectProvider.()

背景:項目啓動沒有問題,可是訪問數據庫報錯。java

2019-01-21 17:42:44.677 ERROR 2966 --- [nio-8037-exec-2] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/micro-order] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseSelectProvider.dynamicSQL).  Cause: java.lang.InstantiationException: tk.mybatis.mapper.provider.base.BaseSelectProvider] with root causespring

java.lang.NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseSelectProvider.<init>()
    at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_171]
    at java.lang.Class.newInstance(Class.java:412) ~[na:1.8.0_171]
    at org.apache.ibatis.builder.annotation.ProviderSqlSource.createSqlSource(ProviderSqlSource.java:117) ~[mybatis-3.4.5.jar:3.4.5]數據庫

解決方式:@MapperScan導入包錯誤,將import org.mybatis.spring.annotation.MapperScan 改爲import tk.mybatis.spring.annotation.MapperScan;apache

@MapperScan(basePackages = "cn.com.autohome.finance.dao")
public class MicroInsuranceOrderServiceApplication {

   public static void main(String[] args) {
      setApolloEnv();
      SpringApplication.run(MicroInsuranceOrderServiceApplication.class, args);
   }
}
相關文章
相關標籤/搜索