1 新建springboot项目(准备工作)
准备工作,适合没有项目但是想练手的小伙伴,如果有项目直接使用可以直接跳到下一部分
要是没有resources目录请查阅【报错】新建springboot项目时缺少resource-优快云博客我的这篇文章讲解了缺少resources的解决方案
2 mybatis逆向工程生成entity和mapper
2.1在pom.xml加入如下依赖
2.2 application
这边主要就把下面的内容全部复制到application之间,注意改一下端口号和数据库名字,其他就可以了
server:
port: 8080
spring:
main:
allow-circular-references: true
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wx_shop?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&serverTimezone=GMT%2b8
username: root
password: 123456
hikari:
max-lifetime: 1000000
thymeleaf:
cache: false #关闭缓存
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.example.entity
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
authority:
info: '[]'
logging:
file:
path: log
name: log/my.log
level:
com:
example:
dao: debug
2.3 generator文档如下
位置如下
具体xml内容如下
<?xml version="1.0" encoding="UTF-8&#