Mapper.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxx.mapper.UserMapper">
</mapper>
application.yml
# 配置启动接口
server:
port: 8080
servlet:
context-path: '/'
encoding:
force: true
charset: utf-8
enabled: true
tomcat:
uri-encoding: UTF-8
# 连接数据库
spring:
datasource:
username: 'root'
password: '123456'
url: 'jdbc:mysql://localhost:3306/tickets?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false'
driver-class-name: 'com.mysql.cj.jdbc.Driver'
web:
resources:
static-locations: classpath:/static, classpath:/mappers, classpath:/templates
servlet:
multipart:
max-file-size: 10MB
max-request-size: 100MB # 上传文件的大小把控 可自定义大小
thymeleaf:
prefix: classpath:/templates/ # 前缀
suffix: .html # 后缀
encoding: utf-8
servlet:
content-type: text/html
cache: false
mybatis:
type-aliases-package: 'com.ym.entity'
mapper-locations: 'classpath:mappers/*.xml'
# 配置日志信息
logging:
level:
com:
example:
demo:
mapper: debug