**.mapper 和 **.**.mapper 的区别
时间: 2024-01-31 22:10:41 浏览: 38
**.mapper**和**.**.mapper的区别在于通配符的使用。
- **.mapper**表示在当前包下查找名为mapper的文件。
- **.**.mapper表示在当前包的上一级包及其子包下查找名为mapper的文件。
例如,如果当前包为com.example,那么**.mapper**将在com.example.mapper中查找文件,而**.**.mapper将在com.example及其子包中查找文件。
相关问题
com.ruoyi.**.*Mapper
在 Java 开发中,com.ruoyi.**.*Mapper 可能是一个 MyBatis 的 Mapper 接口,其作用是将数据库中的数据映射到 Java 对象中,或者将 Java 对象的数据保存到数据库中。Mapper 接口通常包含各种 CRUD(创建、读取、更新、删除)操作,以及其他自定义查询操作。在使用 MyBatis 框架时,通常需要为每个数据表创建一个对应的 Mapper 接口,以便轻松地执行数据库操作。com.ruoyi.** 表示 Mapper 接口所在的包名,* 表示通配符,表示该包下的所有类。因此,com.ruoyi.**.*Mapper 可能是一个通用的 Mapper 接口,用于操作该包下的所有数据表。
mapper/**/*.xml
`mapper/**/*.xml`是一个通配符表达式,用于匹配指定目录下的所有子目录中的xml文件。在这个表达式中,`mapper`表示目录名,`**`表示匹配任意层级的子目录,`*.xml`表示匹配任意文件名以.xml结尾的文件。
以下是两种配置文件中使用`mapper/**/*.xml`的例子:
1. 在pom.xml中的配置:
```xml
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
```
2. 在application.yml中的配置:
```yaml
mybatis:
mapper-locations: classpath:mapper/**/*.xml
```
这两个配置文件中的`mapper/**/*.xml`都表示匹配指定目录下的所有子目录中的xml文件。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)