构建 mybatis 程序遇到的错误


  1. 绑定异常

    org.apache.ibatis.binding.BindingException: Type interface com.alivin.dao.UserDao is not known to the MapperRegistry.


  1. java.lang.ExceptionInInitializerError

    在build中配置 resource,来防止资源导出失败的问题



    
        
            src/main/resources
            
                **/*.properties
                **/*.xml
            
            false
        
        
            src/main/java
            
                **/*.properties
                **/*.xml
            
            false
        
    

  • 可能遇到的问题

    • 配置文件没有注册
    • 绑定接口错误
    • 方法名不对
    • 返回类型不对
    • Maven 导出资源问题