SpringBoot Mybatis-Plus生成的代码 找不到xml的方法

报错场景:

生成代码之后的目录结构

 

解决办法:

1:配置文件添加

mybatis-plus:
  mapper-locations: classpath:com/gosun/mapper/xml/*.xml
  type-aliases-package: com.gosun.entity

 2:pom.xml文件添加

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

完美解决~


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