【MyBatis中主配置文件中出现的错误】
Error while adding the mapper ‘interface com.example.demo.mapper.BlogMapper’ to configuration.
Error parsing Mapper XML. The XML location is ‘com/example/demo/mapper/BlogMapper.xml’. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘Blog’. Cause: java.lang.ClassNotFoundException: Cannot find class: Blog
这个问题按照百度上面搜索的方法进行尝试后任然没有解决。但这个问题最本质的还是xml配置文件里类路径没有配置正确
问题配置如下:
此 type = “Blog” 在解析的过程中,无法识别User 类的位置,所以需要把完整的路径填写好,和 XML里的namespace配置类似
改进配置如下
运行后问题得到解决。