No MyBatis mapper was found in xxx
程序员文章站
2022-07-14 11:33:50
...
SpringBoot 项目启动后输出了这样一个警告:
WARN 8904 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.xxx]' package. Please check your configuration.
很奇怪这个具体是在哪里配置的,难道有默认配置?
个人通过以下方式配置的也生效了,可为什么还会出现这样一个警告呢?
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource());
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:com/xxx/xxx/mapping/*Mapper.xml"));
sqlSessionFactoryBean.setTypeAliasesPackage("com.xxx.xxx.mapping");
return sqlSessionFactoryBean.getObject();
}
看到一段官方文档:
@SpringBootApplication
是一个方便的复合注解,它包含:@Configuration
@EnableAutoConfiguration @EnableWebMvc
@ComponentScan 等注解。
上一篇: Unresolved reference 'xxx' more... (Ctrl+F1)
下一篇: check_jni.cc:70] JNI DETECTED ERROR IN APPLICATION: illegal class name ‘xxx.xxx.xxx’
推荐阅读
-
一个用于MyBatis的辅助页面,自动生成实体,mapper,impl,dao,注册spring,mybatis的小玩意
-
SpringBoot整合mybatis访问时报错Invalid bound statement (not found)
-
mybatis-generator 自动生成mapper以及实体类
-
ubuntu下安装tomcat,shutdown时报错:./catalina.sh:1:eval:/home/xxx/jdk/jre/bin/java:not found
-
扩展mybatis和通用mapper,支持mysql的geometry类型字段
-
mybatis 运行时加载自定义mapper文件方式
-
DB数据源之SpringBoot+MyBatis踏坑过程(二)手工配置数据源与加载Mapper.xml扫描
-
MyBatis开发Dao的原始Dao开发和Mapper动态代理开发
-
Method not found: 'System.Data.Entity.ModelConfiguration.Configuration.XXX
-
详解mybatis-plus的 mapper.xml 路径配置的坑