mybatis mapper.xml文件与接口放在同路径下报“Invalid bound statement"

mybatis的xml文件如果与接口放在一起报错如下:
“org.springframework.security.authentication.InternalAuthenticationServiceException: Invalid bound statement (not found): com.duoduo.hr.mapper.HrMapper.<method name>”

可能是pom.xml文件中忘了添加xml文件配置导致xml文件没被编译,解决办法在pom.xml中添加:

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

 


版权声明:本文为beijihukk原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。