The problem of xml Storage of mybatis in Multi-project springboot

topic description

my project is a maven multi-module project, health-shop-mp (hereinafter referred to as mp) is a springboot project, and other modules are ordinary business modules.
the problem now is that after mp introduces other modules, the xml under the mapper of other modules cannot be used. You can only use the xml of all modules under the mapper folder of mp. This runs counter to my original intention of sub-modules. Do you have any suggestions?

my idea is that each sub-project has its own business implementation from service to xml. Mp directly calls serivce in controller to complete the business logic by introducing various business modules.

A background springboot module will be added later. Now the xml of all business modules is placed under mp, and the background module cannot be called.

if my description is not very clear, you can ask

in the comments.

Welcome to answer

Aug.12,2021

remember to configure it in maven. Add

to the pom.xml configuration in each sub-module
    <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <!-- -->
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

then modify

in the configuration of mybatis.
  mapper-locations: classpath*:mapper/**/*.xml
Menu