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

    之前是,直接在Mapper类上面添加注解@Mapper,这种方式要求每一个mapper类都需要添加此注解,麻烦。 通过使用@MapperScan可以指定要扫描的Mapper类的包的路径,比如:
    @SpringBootApplication
    @MapperScan("com.lz.water.monitor.mapper")
    // 添加对mapper包扫描
    public class Application {
    
    
    public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
    }
    
    }
      同时,使用@MapperScan注解多个包
    @SpringBootApplication  
    @MapperScan({"com.kfit.demo","com.kfit.user"})  
    public class App {  
        public static void main(String[] args) {  
           SpringApplication.run(App.class, args);  
        }  
    }
      如果如果mapper类没有在Spring Boot主程序可以扫描的包或者子包下面,可以使用如下方式进行配置
    @SpringBootApplication  
    @MapperScan({"com.kfit.*.mapper","org.kfit.*.mapper"})  
    public class App {  
        public static void main(String[] args) {  
           SpringApplication.run(App.class, args);  
        }  
    }
     
  • 相关阅读:
    Magento开发文档(一):Magento入门
    Magento开发文档(三):Magento控制器
    CSS 第一天
    iOS 关闭定时器
    thinkphp 5.0 Request使用
    iOS icon与启动图片
    数组
    PHP获取表单变量
    iOS ipa 包优化
    UIImage 渲染模式
  • 原文地址:https://www.cnblogs.com/ZoHy/p/12400653.html
Copyright © 2011-2022 走看看