博客
关于我
springboot整合mybatis使用xml实现sql语句的配置
阅读量:398 次
发布时间:2019-03-05

本文共 625 字,大约阅读时间需要 2 分钟。

首先肯定还是引入mybatis依赖

org.mybatis.spring.boot
mybatis-spring-boot-starter
1.2.0

在启动类处扫描mybatis的mapper类

在这里插入图片描述

写一个mapper接口类

定义好查询方法

在这里插入图片描述

在resources下编写mapper接口类对应的xml文件

在这里插入图片描述

在yml中配置,可以扫描到xml文件

mybatis:  mapper-locations: classpath:mapper/*.xml    #配置mybatis扫描mapper文件xml的路径

在这里插入图片描述

转载地址:http://wjizz.baihongyu.com/

你可能感兴趣的文章
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>
No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
查看>>
No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
查看>>
No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
查看>>