zoukankan      html  css  js  c++  java
  • @Mapper和@MapperScan注解

    1、@Mapper注解:
    作用:在接口类上添加了@Mapper,在编译之后会生成相应的接口实现类
    添加位置:接口类上面

    @Mapper
    public interface UserService{
    // 相应代码
    }

    2、@MapperScan
    作用:指定要变成实现类的接口所在的包,然后包下面的所有接口在编译之后都会生成相应的实现类
    添加位置:是在Springboot启动类上面添加

    @MapperScan(value = "com.llkj.project.entity")
    @SpringBootApplication
    public class LinglingCoreApplication {
        public static void main(String[] args) {
            SpringApplication.run(LinglingCoreApplication.class, args);
        }
    }

    添加@MapperScan(“com.winter.dao”)注解以后,com.winter.dao包下面的接口类,在编译之后都会生成相应的实现类

    3、使用@MapperScan注解多个包
    (实际用的时候根据自己的包路径进行修改)

    @MapperScan(value = {"com.llkj.project.entity","com.llkj.picc.entity"})
    @SpringBootApplication
    public class LinglingCoreApplication {
        public static void main(String[] args) {
            SpringApplication.run(LinglingCoreApplication.class, args);
        }
    }
  • 相关阅读:
    Python 模块管理
    Python 练习: 计算器
    Linux 系统性能分析工具 sar
    Python 正则介绍
    Python ConfigParser 模块
    Python logging 模块
    Python hashlib 模块
    Python sys 模块
    09 下拉框 数据验证
    08 条件排序
  • 原文地址:https://www.cnblogs.com/zhanqing/p/15145874.html
Copyright © 2011-2022 走看看