springboot mybatis-plus分页配置不生效【我】
转:
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);
}
}

浙公网安备 33010602011771号