在springboot 项目中遇到了这个问题,整半天。。。又来吃一堑,又吃一堑了:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yaspeed.cache.mapper.EmployeeMapper.selectAll
我的解决方案:
在DdruidConfiguration中配置
@Bean
public SqlSessionFactoryBean sqlSessionFactory() throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
//pojo别名
// sessionFactory.setTypeAliasesPackage("com.yaspeed.pojo");
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/*Mapper.xml"));
// sessionFactory.setPlugins(new Interceptor[]{new SqlCostInterceptor()});
return sessionFactory;
}
顺便记录下:
-
springboot必配
-
springboot中mybatis必加的注解
-
springboot中mapper文件必检查