码迷,mamicode.com
首页 > 移动开发 > 详细

spring boot mybatis没有扫描jar中的Mapper接口

时间:2018-03-05 11:17:49      阅读:545      评论:0      收藏:0      [点我收藏+]

标签:指定   pos   scan   jar   bsp   tap   ack   rgs   color   

只需要在spring boot启动类上加上注解,并指定jar包中接口文件包路径即可

如下:

@ComponentScan(basePackages = "com.xx")
@MapperScan(basePackages = "com.xx.**.dao")
@SpringBootApplication
@EnableCaching
@EnableDiscoveryClient
public class EnterApplication {
    public static void main(String[] args) {
        SpringApplication.run(EnterApplication.class,args);
    }
}

如此com.xx包下的任意级子目录下的dao包下的所有接口都会被扫描到,包括jar包中的。

spring boot mybatis没有扫描jar中的Mapper接口

标签:指定   pos   scan   jar   bsp   tap   ack   rgs   color   

原文地址:https://www.cnblogs.com/flying607/p/8507546.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!