006-Mapper.xml未被编译

150 阅读1分钟

运行项目,浏览器报错500

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.javapandeng.mapper.ManageMapper.getByEntity

根据提示我们可以想到和Mapper.xml文件有关,又因为提示了Invalid这个关键词,我们可以想到该文件未被编译

打开target目录查看,可以看有没有Mapper.xml

没有则在pom.xml中添加如下代码

 <resources> 
            <resource> 
                <directory>src/main/java</directory> 
                <includes> 
                    <include>**/*.xml</include> 
                </includes> 
                <filtering>true</filtering> 
            </resource> 
        </resources>