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

    我们在mapper的接口上使用@Mapper注解,在编译之后会生成相应的接口实现类,这样每个mapper接口上都要使用@Mapper注解,这样太麻烦了,我们可以使用@MapperScan注解

    1.@MapperScan注解的使用

    Springboot启动类上面添加@MapperScan注解,就指定mapper接口所在的包,然后包下面的所有接口在编译之后都会生成相应的实现类

    @SpringBootApplication
    @MapperScan(basePackages= {"com.qingfeng.mapper"})
    public class Application {
    
    	public static void main(String[] args) {
    		SpringApplication.run(Application.class, args);
    	}
    
    }
    

     

    使用扫描多个mapper,用逗号分隔开

    @SpringBootApplication
    @MapperScan(basePackages= {"com.qingfeng.mapper","com.qing.mapper"})
    public class Application {
    
    	public static void main(String[] args) {
    		SpringApplication.run(Application.class, args);
    	}
    
    }
    

      

  • 相关阅读:
    神经网络 初步
    SVM整理
    碎碎念
    random note
    2015阿里实习内推一轮被拒
    django开发框架-view & template
    一点思考
    dive into python 读笔(3)
    dive into python 读笔(2)
    dive into python 读笔(1)
  • 原文地址:https://www.cnblogs.com/Amywangqing/p/12896663.html
Copyright © 2011-2022 走看看