springboot整合mybatis 资源过滤问题

这篇博客介绍了如何在Spring Boot中整合MyBatis,通过添加mybatis-spring-boot-starter依赖进行配置。同时,展示了如何在pom.xml中配置maven资源过滤,确保XML文件能被正确处理。还提到了在yaml配置文件中指定MyBatis的mapper映射文件和类型别名包的位置。
摘要由CSDN通过智能技术生成

官方文档:http://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfifigure/

<dependency> 
    <groupId>org.mybatis.spring.boot</groupId> 
    <artifactId>mybatis-spring-boot-starter</artifactId> 
    <version>2.1.1</version> 
</dependency>
maven静态资源过滤

这个是在pom.xml的build层级下

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

yaml配置文件 提供路径 classpath是对应编译文件的位置 target下的class文件夹(在这个下面找,有说明xml文件解析到了)

#指定myBatis的核心配置文件与Mapper映射文件 
mybatis.mapper-locations=classpath:mybatis/mapper/*.xml 
# 注意:对应实体类的路径 
mybatis.type-aliases-package=com.fan.mybatis.pojo
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值