springboot结合mybatis-plus出现“No qualifying bean of type 'com.**.mapper.XXMapper' available”错误的解决办法

Java | 2021-07-17 00:07:50 | 阅读 1595 次 | 评论(1)

办法一:

给XXMapper.java加上Mapper注解,如:

import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ArticleMapper extends BaseMapper<ArticleEntity> {
}


办法二:

给启动类加上MapperScan注解,如:

import org.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@MapperScan("com.example.**.mapper")
public class BlogApplication {
    public static void main(String[] args) {
        SpringApplication.run(BlogApplication.class, args);
    }
}

文章评论,共1条
械济厚对(游客)
2021-09-07 10:58
1
游客请输入验证码
浏览2344348次
文章归档
最新评论