No MyBatis mapper was found in xxx

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  等注解。


猜你喜欢

转载自blog.csdn.net/testcs_dn/article/details/80923260