No MyBatis mapper was found in '[cn.itcast]' package 通用mapper注入问题

版权声明:本站所提供的文章资讯、软件资源、素材源码等内容均为本作者提供、网友推荐、互联网整理而来(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考,如有侵犯您的版权,请联系我,本作者将在三个工作日内改正。 https://blog.csdn.net/weixin_42323802/article/details/84616165
声明、使用springcloud 2.0.1 、mysql8 、JDK8、idea

在springcloud 使用通用mapper 过程中,存在通用mapper 注入问题;
启动springboot ,发现警告如下:
No MyBatis mapper was found in ‘[cn.itcast]’ package. Please check your configuration.
1

原因及解决方案:
  • 通用mapper的原因,通用mapper虽然方便,弃用了,使用mybatis-generator
  • 在mapper接口上添加 @Mapper注解,声明这个mapper 接口
import cn.itcast.pojo.User;
import tk.mybatis.mapper.common.Mapper;
@org.apache.ibatis.annotations.Mapper   //加@Mapper
public interface UserMapper extends Mapper<User> {
}

好的,世界安静了,通用mapper ,食之无味,弃之可惜;
对于简单逻辑很是方便,奈何用不了;
s

猜你喜欢

转载自blog.csdn.net/weixin_42323802/article/details/84616165