问答详情
源自:3-6 dao层开发

java.lang.IllegalArgumentException: At least one base package must be specified

java.lang.IllegalArgumentException: At least one base package must be specified 一直报这个错误 我mapper的路径写错了吗

提问者:伊森丶 2018-09-06 18:16

个回答

  • 慕虎638682
    2018-09-10 18:43:05

    错误原因:没有在主函数的类中对Mapper层进行扫描。

    解决:加上对mapper层的扫描MapperScan

    @ComponentScan(basePackages = { "cn.iponkan.controller"})

    @MapperScan(basePackages = {"cn.iponkan.mapper"})

    @EnableAutoConfiguration

    public class SpringBootApplication {

        public static void main(String[] args){

            SpringApplication.run(SpringBootApplication.class,args);

        }

    }