当我们把接口文件和mapper.xml文件写在同一目录下比如:
当然我们也在mybatis-config.xml核心配置文件中注册过了, 为什么控制台还是报初始化异常找不到的错误呢?
初始化异常:
java.lang.ExceptionInInitializerError
Error building SqlSession.
The error may exist in org/example/mapper/SmbmsUserMapper.xml
Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource org/example/mapper/SmbmsUserMapper.xml
这是资源过滤问题!!!
为什么会有资源过滤问题呢?
因为我们的Maven,在学习Maven的时候, 有一句话:
Maven的约定大于