提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
目录
一、添加Mybatis的starter maven依赖
二、在mybatis的接口中添加@Mapper注解
三、在application.yml配置数据源信息
一、添加Mybatis的starter maven依赖
org.mybatis.spring.boot
mybatis-spring-boot-starter
1.3.2
二、在mybatis的接口中添加@Mapper注解
@Mapper
public interface UserMapper {
Integer login(User user);
}
select count(1) from user where name= #{name} and password= #{password}
三、在application.yml配置数据源信息
mybatis:
mapper-locations: classpath:mappers/*.xml
以上就是SpringBoot集成Mybatis的步骤



