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

只需要在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包中的。

posted @ 2018-03-05 10:10  剑握在手  阅读(8766)  评论(1编辑  收藏  举报
返回顶部↑