轉:
SpringBoot + MyBatis-Plus分頁插件不生效解決辦法
https://blog.csdn.net/weixin_41432270/article/details/103072230
原來是啟動類沒有指定掃描包,配置類和組件類默認需要在啟動類所在包或其子包下,如果不是,需要使用@ComponentScan指定,在啟動類添加,我是直接掃描所有包,可以直接掃描配置類所在包
@ComponentScan("com.example.mybatis.plus.mybatisplus.*")
關鍵就是如果config配置類不在啟動類所在包或其子包,要在啟動類上添加掃描包注解掃描到config類
@SpringBootApplication(scanBasePackages = {"com.tc.crm.order.query",
"com.tc.crm.common.aspect",
"com.tc.crm.common.config"
})
public class OrderQueryApplication {
public static void main(String[] args) {
SpringApplication.run(OrderQueryApplication.class, args);
}
}
