Mybatis(plus)自定义xml文件位置,与mapper同级

1.修改yml配置文件

配置xml文件所在位置

mybatis-plus:
  mapper-locations: classpath*:com/hn/renting/modules/**/mapper/xml/*Mapper.xml

2.修改pom.xml

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>

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

3.编译项目后

xml文件出现在配置的位置说明成功了


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