mapstruct 使用时 mybatis报错:Invalid bound statement (not found)

2,089 阅读1分钟

mapstruct mybatis 出现问题

mybatis报错:Invalid bound statement (not found)

mybatis 中含有Mapper注解:在扫描包配置的时候注意与mapstruct 的兼容
@MapperScan 作用:指定要变成实现类的接口所在的包,然后包下面的所有接口在编译之后都会生成相应的实现类 添加位置:是在Springboot启动类上面添加,或者 拦截器上添加

@SpringBootApplication
@MapperScan("com.winter.dao")
public class SpringbootMybatisDemoApplication {
    public static void main(String[] args) {        
    SpringApplication.run(SpringbootMybatisDemoApplication.class, args);    
    }
}

不能将 mapstruct 映射java类放在com.winter.dao 目录下。否者会出现刚才的 Invalid bound statement (not found)