在pom.xml中添加相关依赖。

        <!--MyBatis分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>
<!--集成druid连接池-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.10</version>
</dependency>
<!--Mysql数据库驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>

在application.yml中添加数据源配置和MyBatis的mapper.xml的路径配置。

server:
port: 8080 spring:
datasource:
url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
username: root
password: root mybatis:
mapper-locations:
- classpath:mapper/*.xml
- classpath*:com/**/mapper/*.xml

参考文章:https://macrozheng.github.io/mall-learning/#/architect/mall_arch_01

springboot整合mybaties的更多相关文章

  1. SpringBoot(9) SpringBoot整合Mybaties

    一.近几年常用的访问数据库的方式和优缺点 1.原始java访问数据库 开发流程麻烦 <1>注册驱动/加载驱动 Class.forName("com.mysql.jdbc.Driv ...

  2. springBoot(7)---整合Mybaties增删改查

    整合Mybaties增删改查 1.填写pom.xml <!-- mybatis依赖jar包 --> <dependency> <groupId>org.mybati ...

  3. 【SpringBoot】数据库操作之整合Mybaties和事务讲解

    ========================8.数据库操作之整合Mybaties和事务讲解 ================================ 1.SpringBoot2.x持久化数 ...

  4. SpringBoot整合SpringBatch

    一.引入依赖 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&q ...

  5. spring-boot整合mybatis(1)

    sprig-boot是一个微服务架构,加快了spring工程快速开发,以及简便了配置.接下来开始spring-boot与mybatis的整合. 1.创建一个maven工程命名为spring-boot- ...

  6. SpringBoot整合Mybatis之项目结构、数据源

    已经有好些日子没有总结了,不是变懒了,而是我一直在奋力学习springboot的路上,现在也算是完成了第一阶段的学习,今天给各位总结总结. 之前在网上找过不少关于springboot的教程,都是一些比 ...

  7. springboot整合mq接收消息队列

    继上篇springboot整合mq发送消息队列 本篇主要在上篇基础上进行activiemq消息队列的接收springboot整合mq发送消息队列 第一步:新建marven项目,配置pom文件 < ...

  8. springboot整合mybaits注解开发

    springboot整合mybaits注解开发时,返回json或者map对象时,如果一个字段的value为空,需要更改springboot的配置文件 mybatis: configuration: c ...

  9. SpringBoot整合Redis、ApachSolr和SpringSession

    SpringBoot整合Redis.ApachSolr和SpringSession 一.简介 SpringBoot自从问世以来,以其方便的配置受到了广大开发者的青睐.它提供了各种starter简化很多 ...

随机推荐

  1. 如何寻找sql注入漏洞?

    1.sql注入是怎么产生的 2.如何寻找sql注入漏洞 在地址栏输入单双引号造成sql执行异常(get) post请求,在标题后输入单引号,造成sql执行异常.

  2. svn: E155004: Working copy '/data/www' locked.

    svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) svn: E155004: Working c ...

  3. python的tkinter,能画什么图?

    今天从下午忙到现在,睡觉. 这个能绘点图的. import json import tkinter as tk from tkinter import filedialog from tkinter ...

  4. GIL锁是什么鬼?

    参考链接: http://cenalulu.github.io/python/gil-in-python/ GIL不是Python特性 GIL是Python解释器(Cpython)时引入的概念,在JP ...

  5. LeetCode 1239. Maximum Length of a Concatenated String with Unique Characters

    原题链接在这里:https://leetcode.com/problems/maximum-length-of-a-concatenated-string-with-unique-characters ...

  6. zabbix值显示的问题

    虽然在创建监控项的时候,是可以选值类型的,目前有的是整型,浮点型,日志,文本,字符串.但是不要误认为zabbix采集数据的时候就是按照这个格式采集的. zabbix各种接口采集到的数据都是字符串类型, ...

  7. bash循环得到日期目录

    #!/bin/bash today=$(date "+%Y%m%d") echo 'today is :'${today} single_input="raw_data/ ...

  8. GitHub页面基本知识

    官网地址:https://help.github.com/categories/github-pages-basics/ GitHub页面是什么? GitHub页面是一个静态的站点托管服务. GitH ...

  9. Eclipse Maven问题小记

    Eclipse Maven Web工程报错:java.lang.ClassNotFoundException: ContextLoaderListener 原因:打包项目时没有把相关Maven依赖包打 ...

  10. git:GitLab代码回滚到特定版本

    在当前branch上多次commit代码并且push后,发现不符合要求,需要回滚到特定的版本.步骤如下: 1.查找commitId (1)用命令行打开git项目路径,输入git log命令查看comm ...