Cause of org.apache.ibatis.binding.BindingException in mybatis project

1. Are the mapper interface and mapper.xml in the same package? Are the names the same (only the suffix is ​​different)?

2. Is the namespace of mapper.xml the same as the package name of the mapper interface?

3. The method name of the interface is the same as the id of a sql tag in xml

4. If the return value List collection in the interface (do not know other collections are also), then the configuration in xml, try to use resultMap (to ensure that the resultMap configuration is correct), do not use resultType

5. If your project is a maven project, please take a look at the directory where the interface is located after compilation. It is likely that the corresponding xml file is not produced, because maven is not compiled by default, so you need to In the <build> </ build> of pom.xml, add this paragraph:

    <resources>    
        <resource>    
            <directory> src / main / java </ directory>    
            <includes>    
                <include> ** / *. xml </ include>    
            </ includes>    
            <filtering> true </ filtering>    
        </ resource>    
    </ resources>   
————————————————
Copyright Notice: This article is an original article by CSDN blogger "Twenty-Handsome", follow the CC 4.0 BY-SA copyright agreement, please reprint please Attach the original source link and this statement.
Original link: https://blog.csdn.net/qq_18298439/article/details/80586789

 

Attach one:

6. Whether ~~~~ dao.xml file is configured in <mapper> in SqlMapMapper file.

Published 108 original articles · praised 48 · 50,000+ views

Guess you like

Origin blog.csdn.net/larry1648637120/article/details/100631349