推荐:体系化学习Java(Java面试专题)
这个问题其实是粗心引起的。
在配置数据源的时候,黏贴下代码
@Bean(name = "mysqlSqlSessionFactory")
public SqlSessionFactory mysqlSqlSessionFactoryBean()throws Exception {
SqlSessionFactoryBean factory=new SqlSessionFactoryBean();
factory.setDataSource(mysqlDataSource());
factory.setTypeAliasesPackage("com.example.clickhousedemo.entity.mysql");
ResourcePatternResolver resourcePatternResolver=new PathMatchingResourcePatternResolver();
factory.setMapperLocations(resourcePatternResolver.getResources("classpath:mapper/mysql/*.xml"));
factory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
return factory.getObject();
}
factory.setMapperLocations(resourcePatternResolver.getResources(“classpath:mapper/mysql/*.xml”));
这一行注意是resourcePatternResolver.getResources(),tab直接快了,写成了getResource() 少了个s导致了xml找不到。
致那些粗心的同学!!!