MyBatis-Spring-Boot
MyBatis-Spring-Boot copied to clipboard
No MyBatis mapper
RT: 为什么会报这个警告?但是不影响使用!
debug 如下:
这是第一次的:
这是第二次的:

强迫症,也在看这个问题。
入口应该是在
tk.mybatis.mapper.autoconfigure.MapperAutoConfiguration
或org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration
如果没有MapperFactoryBean实例,则从根路径扫描@Mapper注解类
在Application类上已经使用了tk的@MapperScan注解,启动信息显示没有找到MapperFactoryBean实例,但debug发现已经扫描到了Mapper,这就让我很费解了。
至于两次warn是因为Pagehelper依赖mybatis-spring-boot-starter
如果集成了mapper-spring-boot-starter和pagehelper-spring-boot-starter
就屏蔽掉Mybatis中的自动配置,减少一次扫描@Mapper。
@SpringBootApplication(exclude = MybatisAutoConfiguration.class)
剩下的一次WARN忽略掉吧,为了兼容@Mapper注解,这里做个开关会比较好。