该配置文件中配置了 静态文件访问路径、tomcat日志信息、文件上传大小限制、mybatis plus、redis 、quartz定时器、邮箱 等等
server:
port: 8080
address: 192.168.0.109 #设置服务器绑定的网络地址(设置服务器将监听的 IP地址)
servlet:
context-path: xxx # 如果不配置 则浏览器的访问路径就是 端口号/控制层名字/接口名 配置后就是 端口号/xxx/控制层名字/接口名
compression: #是否开启压缩,默认为false.
enabled: true
min-response-size: 1024 # 压缩的阈值,默认为2048 mime-types:指定要压缩的MIME type,多个以逗号分隔.
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
# 配置tomcat的访问日志的目录名 前缀 后缀 日期格式
tomcat:
accesslog:
directory: logs
file-date-format: yyyy-MM-dd
prefix: access_log
suffix: .log
error:
whitelabel: #Spring Boot提供标准错误网页。此页面称为Whitelabel。它默认启用,但如果我们不想显示任何错误信息,我们可以禁用他 (false)
enabled: false
path: /user-error #Whitelabel的默认路径是*/error*。可以通过设置server.error.path参数设置指定的错误信息页
include-exception: true #还可以设置属性,以确定显示有关错误的信息。例如,我们可以包含错误消息和堆栈跟踪:
include-stacktrace: always
spring:
servlet:
multipart:
max-file-size: 10MB # 单个数据的大小
max-request-size: 10MB # 总数据的大小
mvc: # 设置静态文件访问路径,js,css等
static-path-pattern: /**
resource:
static-locations: classpath:/static/,classpath:/public/
autoconfigure: # 排除自动配置 即禁用springboot某些类的自动化配置 像数据源什么的 还有其他的配置方法(https://www.cnblogs.com/javastack/p/12016212.html)
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver # 数据库JDBC驱动
username: root
password: root
url: jdbc:mysql://localhost:3306/data_base_name?serverTimezone=CTT&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true
druid:
stat-view-servlet:
enabled: true # 禁止手动重置监控数据(false)
loginUsername: admin # 设置监控页面的登录名和密码
loginPassword: 123456
allow:
web-stat-filter:
enabled: true #是否启用StatFilter默认值true
#redis 配置
redis:
database: 0
host: 127.0.0.1
lettuce:
pool:
max-active: 8 #最大连接数据库连接数,设 0 为没有限制
max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
shutdown-timeout: 100ms
password: ''
port: 6379
#mybatis plus 设置
mybatis-plus: # 配置映射文件扫描路径
mapper-locations: classpath*:com/modules/**/xml/*Mapper.xml
type-aliases-package: com.modules.*.entity
global-config:
# 关闭MP3.0自带的banner
banner: false
db-config:
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
id-type: 4
# 默认数据库表下划线命名
table-underline: true
#configuration:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
## quartz定时任务,采用数据库方式
quartz:
job-store-type: jdbc
#json 时间戳统一转换
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
aop:
proxy-target-class: true
#配置freemarker
freemarker:
# 设置模板后缀名
suffix: .ftl
# 设置文档类型
content-type: text/html
# 设置页面编码格式
charset: UTF-8
# 设置页面缓存
cache: false
prefer-file-system-access: false
# 设置ftl文件路径
template-loader-path:
- classpath:/templates
mail: #邮箱配置 pom.xml引入 spring-boot-starter-mail、 spring-boot-starter-freemarker
host: smtp.163.com
username: vring@foxmail.com
password: xxx
properties:
mail:
smtp:
auth: true
starttls:
enable: true
required: true
#Mybatis输出sql日志
logging:
level:
org.jeecg.modules.system.mapper : debug
#cas单点登录
cas:
prefixUrl: http://cas.example.org:8443/cas
#设置一个邮件发送人
lance:
mail:
sender: 1909223201@qq.com