当前位置: 首页 > 工具软件 > Mapper > 使用案例 >

mapper与mapper.xml的对那个关系处理

钦高峯
2023-12-01

1、文件:MybatisPlusConfig.java

  作用:扫描mapper接口 @MapperScan(basePackages = "com.h3c.fang.**.mapper")

2、文件: pom.xml

  作用:建立mapper与mapper.xml的对应关系;

  内容:
  <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/**</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>

3、mapper路径与mapper.xml路径不一致的情况
文件:application.yaml
内容:
mybatis:
mapper-locations: classpath:mybatis/*.xml

 类似资料: