zoukankan      html  css  js  c++  java
  • 'com.example.mybatisplus.mapper.PersonMapper' that could not be found.

    通常有两种原因,配置原因,或者是mapper相关文件,mapper.java或 mapper.xml内部错误

    如果是配置原因

    解决方式1

    统一配置mapper

    //import org.mybatis.spring.annotation.MapperScan;
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
    @SpringBootApplication
    @MapperScan("com.example.mybatisplus.mapper")  //把这个加上,别写上正确的路径,如果是模块化一般路径为@MapperScan("com.kfit.*.mapper")  
    public class Application {
    
        public static void main(String[] args){
            System.out.println("hahahaha");
             SpringApplication.run(Application.class, args);
        }
    
        
    }

    解决方式2

    每个mapper文件配置@Mapper

    package com.example.mybatisplus.mapper;
    
    //import org.apache.ibatis.annotations.Mapper;
    
    import com.baomidou.mybatisplus.mapper.BaseMapper;
    import com.example.mybatisplus.entity.Person;
    @Mapper     //每个文件配置这个
    public interface PersonMapper extends BaseMapper<Person> {
    Integer listCount();
    Person findPersonById(Integer id);
    }

    两者可以结合使用

  • 相关阅读:
    jQuery全选反选全不选
    Ubuntu安装VMware Workstation8.0.3
    ubuntu安装的软件如何启动
    ubuntu装VirtualBox遇到的问题
    你是优秀的PHP程序员吗?
    VMWare 三种工作模式(bridged、hostonly、NAT)
    最近要做的事
    090224
    2月23日 月曜日
    周五 26日
  • 原文地址:https://www.cnblogs.com/dianzan/p/11246034.html
Copyright © 2011-2022 走看看